title: Printing bytes of UTF-8 string in C
body: <p>I wanted to print individual bytes of word "česnek" expecting to printf 7 bytes, because "č" is coded in 2 bytes, which it does but prints garbage character such as a question mark in terminal. If I print out the integer value, I get this sequence.</p>
  
  <pre><code>-60 -115 101 115 110 101 107
  </code></pre>
  
  <p>Why are the first two numbers negative?
  Here is the code I used to try it.</p>
  
  <pre><code> char *utfstring = "česnek";
   for(size_t i = 0; i &lt; strlen(utfstring); i++) {
   printf("%c ", utfstring[i]);
   }
   for(size_t i = 0; i &lt; strlen(utfstring); i++) {
   printf("%d ", utfstring[i]);
   }
  </code></pre>
  
  <p>I expected first two values to be c4 8d because č is encoded like that according to <a href="https://www.utf8-chartable.de/unicode-utf8-table.pl?start=256&amp;unicodeinhtml=dec" rel="nofollow noreferrer">https://www.utf8-chartable.de/unicode-utf8-table.pl?start=256&amp;unicodeinhtml=dec</a></p>