About 3,130,000 results
Open links in new tab
  1. 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(), …

  2. How do I properly use scanf and what are its limits?

    Aug 3, 2025 · Thanks for asking. Here are some guidelines for using scanf within its limits. And here is a question abut alternatives 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. scanf: This function or variable may be unsafe - Stack Overflow

    Oct 26, 2022 · scanf doesn't know that - as written, it doesn't know that str can only hold that many characters. If your input is 100 characters long, scanf will happily write those extra 90 …

  5. 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", &...

  6. c - Why does scanf require &? - Stack Overflow

    Oct 19, 2016 · C function parameters are always "pass-by-value", which means that the function scanf only sees a copy of the current value of whatever you specify as the argument expression.

  7. c - Using the scanf () function - Stack Overflow

    Apr 4, 2013 · scanf("%s", userinput); The address of operator & is unrequired, and incorrect. Arrays decay to the address of their first element when passed to a function. scanf("%s") will …

  8. error C4996: 'scanf': This function or variable may be unsafe in c ...

    Jun 1, 2015 · The wikia link says scanf_s is " the same as scanf, except it is safe." Is there any reason why an implementation that can support scanf_s should have scanf not chain to the …

  9. 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.

  10. c - Using the scanf function in while loop - Stack Overflow

    Nov 1, 2014 · The reason is scanf reads directly from the standard input and which blocks and waits for user input after it has processed the line. What you need to do is read the line and …