title: Store accented letters in C variable
body: <p>My main language is portuguese so we have some accented words (with á é í ó ú... etc characters) i'm trying to read and store those characters into a variable but it just doesn't work. If i just set it on the code it works, but if i ask the user for input it doesn't. Example code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;locale.h&gt;
  
  int main(int argc, char *argv[]) {
      setlocale(LC_ALL, "Portuguese");
  
      char test, test2; //The same still happens using unsigned char
  
      test = 'í';
  
      printf("Character: %c\n", test);
  
      scanf(" %c", &amp;test2); //The same still happens using fgets in case of a string
  
      printf("Character: %c\n", test2);
  
      system("pause");
  
      return 0;
  }
  </code></pre>
  
  <p>When compiled and executed the code shows:</p>
  
  <p>Character: í</p>
  
  <p>(wait for input, example:) í</p>
  
  <p>character: ¡ </p>
  
  <p>if input is 'á' it prints ' '(space), 'é' prints ', ó prints '¢' and ú prints '£'.</p>
  
  <p>I'm new into programming and stackoverflow, so sorry for any mistake i made, every help is appreciated, thank you.</p>
  
  <p>oh, also I'm using Dev-c++ to compile if this make any difference.</p>