About 103,000 results
Open links in new tab
  1. c - Getting multiple values with scanf () - Stack Overflow

    I am using scanf() to get a set of ints from the user. But I would like the user to supply all 4 ints at once instead of 4 different promps. I know I can get one value by doing: scanf( "%i", &...

  2. How to do scanf for single char in C - Stack Overflow

    Nov 24, 2012 · The %c conversion specifier won't automatically skip any leading whitespace, so if there's a stray newline in the input stream (from a previous entry, for example) the scanf call …

  3. 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, …

  4. 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 …

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

    Reading in double values with scanf in c Asked 12 years, 11 months ago Modified 3 years, 5 months ago Viewed 453k times

  6. getting values for an array using scanf function in C

    Jun 27, 2017 · The function scanf() places the input from stdin to wherever you tell it. The second argument you are providing in scanf() is not a pointer directing where the input from the user …

  7. 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, …

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

    This is because in C, functions parameters are passed by value. In order for the scanf() function to modify the ' a ' variable in your main () function, the address of ' a ' shall be given to scanf(), …

  9. What does `scanf ("%* [^\n]%*c")` mean? - Stack Overflow

    May 6, 2015 · It is better to use scanf("%*[^\n]"); scanf("%*c"); to clear the stdin. This is because, in the former case (single scanf), %*[^\n] will fail when the first character to be scanned is the …

  10. c - scanf Getting Skipped - Stack Overflow

    I am trying to make a simple C program for a class and one of the requirements is that I'm required to use scanf / printf for all input and output. My question is why is it that my scanf after …