title: Character User-input Either Skipped or not Skipped yet not Stored
body: <p>I am currently attempting to obtain a user character input which proceeds a user non-character input, such as integer, float/double, etc. I've read several Stack overflow solutions, and not a single one seems to work for me. Here are the six different ways I attempted to write this code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main(void)
  {
    int integer;
    char character;
    scanf("%d", &amp;integer);
    fflush(stdin);
    scanf("%c", &amp;character);
    printf("The ASCII Code of %c is %d", character, character);
  </code></pre>
  
  <p>This gave an ASCII Code of 10 (\n, i.e. line feed character) implying fflush(stdin) did not flush the line feed whitespace. Then, from this, it would be more relevant and convenient if we looked at lines 7-8. Now, I deleted fflush(stdin) and added a space before %c conversion specifier in scanf(), i.e.
  <code>scanf(" %c", &amp;character)</code> This also did not work, thus I tried the following:
  <code>scanf("%c\n", &amp;character)</code> This did allow me to input a value, unlike the previous scenarios, albeit the character was not the same as that inputted because the ASCII code generated was still 10. I also attempted to manipulate the code using <code>getchar()</code> but the ASCII code was either 0 or 10 (space or line feed) and not the actual character input. Thus, I would very much appreciate it if anyone knows a way to resolve this issue. Thank you!</p>