About 7,620,000 results
Open links in new tab
  1. c - Why does scanf require &? - Stack Overflow

    Oct 19, 2016 · I want to read a number from stdin. I don't understand why scanf requires the use of & before the name of my variable: int i; scanf("%d", &i); Why does scanf need the …

  2. 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(), …

  3. c - What does the scanf function return? - Stack Overflow

    10 From scanf: On success, the function returns the number of items successfully read. This count can match the expected number of readings or fewer, even zero, if a matching failure …

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

  5. Is there a way to use scanf with the "if" and "else" statements?

    May 22, 2013 · I have to create and call a function from main. Then I have to call scanf to read two integers and print out the bigger one. Then I have to do another scanf, but this time with …

  6. scanf () leaves the newline character in the buffer

    The scanf() function skips leading whitespace automatically before trying to parse conversions other than characters. The character formats (primarily %c; also scan sets %[…] — and %n) …

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

    In case 1, the better solution is, do not mix calls to scanf with other input functions. Either do all your input with scanf, or do all your input with getchar and/or fgets. To do all your input with …

  8. What is the purpose of using the [^ notation in scanf?

    When the scanf() function completes, the input is pointing at the next newline character. The body of the loop reads and prints that character, so that when the loop restarts, the input is looking …

  9. How do you allow spaces to be entered using scanf?

    Aug 8, 2009 · You can put maximum buffer size in scanf format, you just can't put runtime computed one without building the format at runtime (there isn't the equivalent of * for printf, * …

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

    Jul 10, 2015 · And the difference between gets/scanf and fgets is that gets(); and scanf(); only scan until the first space ' ' while fgets(); scans the whole input. (but be sure to clean the buffer …