
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 address …
c - What does the scanf function return? - Stack Overflow
10 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 happens. In the case of …
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.
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.
c - Em quais casos scanf é seguro? E em quais casos deve ...
Feb 13, 2022 · Scanf lê o número e retorna 1 (o retorno de scanf indica o número de valores atribuídos com sucesso). Entretanto, acontece overflow e de acordo com a C Standard o overflow de inteiros …
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 doubles …
What are scanf("%*s") and scanf("%*d") format identifiers?
Dec 7, 2018 · So scanf("%*d %d", &i); would read two integers and put the second one in i. The value that was output in your code is just the value that was in the uninitialized i variable - the scanf call …
Using "\\n" in scanf() in C - Stack Overflow
An '\n' - or any whitespace character - in the format string consumes an entire (possibly empty) sequence of whitespace characters in the input. So the scanf only returns when it encounters the …
Por que não precisa do `&` no `scanf ();`? - Stack Overflow em Português
Você está passando uma variável para a função não porque precisa mandar um valor para a função, de fato a variável pode nem ter um valor válido, para o scanf() isto não importa, a questão é que no …
c - Difference between scanf () and fgets () - Stack Overflow
Aug 9, 2009 · Another clear difference is the return value: fgets return a pointer to dest on success; scanf return the number of input items successefully matched and assigned. Then, the scanf function …