-->

Explain scanf function in C

0 minute read

 Explain Scanf function in C

The scanf () function allows you to accept input from user.
scanf("%d", &b); 
The program will read an integer value from the user (%d is for integers, as is printf, so b must be declared as an int) and place that value into b.
We must put & in front of the variable used in scanf. The reason why will discuss when we learn about pointers.