About 141,000 results
Open links in new tab
  1. How to do scanf for single char in C - Stack Overflow

    Nov 24, 2012 · scanf(" %c", &c); The blank in the format string tells scanf to skip leading whitespace, and the first non-whitespace character will be read with the %c conversion specifier.

  2. c - Getting multiple values with scanf () - Stack Overflow

    Getting multiple values with scanf () Asked 16 years, 3 months ago Modified 4 years, 6 months ago Viewed 334k times

  3. How does the scanf function work in C? - Stack Overflow

    The & in C is an operator that returns the address of the operand. Think of it this way, if you would simply give scanf the variable a without the &, it will be passed to it by-value, which means scanf will …

  4. io - How can I clear an input buffer in C? - Stack Overflow

    The C runtime library will take care of that for you: your program will see just '\n' for newlines. If you typed a character and pressed enter, then that input character would be read by line 1, and then '\n' …

  5. How does scanf(" %[^\\n]", str); work in C Programming?

    Apr 15, 2017 · This scanf format string consists of two parts: a space character, which skips space characters (' ', '\t', '\n', etcetera) in the input, and the %[^\n] conversion specification, which matches a …

  6. C: Multiple scanf's, when I enter in a value for one scanf it skips the ...

    Mar 5, 2012 · The scanf("%c") will immediately read this newline character, and the program will then go on to the next scanf("%d"), and wait for you to enter a number. The usual advice is to read entire …

  7. Reading in double values with scanf in c - Stack Overflow

    70 I try to read-in 2 values using scanf () in C, but the values the system writes into memory are not equal to my entered values. Here is the code:

  8. C programming scanf () not working correctly - Stack Overflow

    Jan 3, 2014 · C programming scanf () not working correctly [duplicate] Asked 11 years, 11 months ago Modified 11 years, 11 months ago Viewed 12k times

  9. C - scanf () vs gets () vs fgets () - Stack Overflow

    Jul 10, 2015 · Third, when using scanf() function, the result is completely wrong because first character apparently has a -52 ASCII value. For this, I have no explanation. Now I know that gets() is …

  10. c - How do I properly use scanf and what are its limits ... - Stack ...

    Aug 3, 2025 · So, just do scanf("%d", &weight); and scanf("%d", &height); without anything more in the formats. I also encourage you not to use global vars when you do not really need to, and to check …