------<a href= "http://www.itheima.com" target= "blank" >java training, Android training, iOS training,. NET training </a>, look forward to communicating with you! -------
scanf function
The SCANF function prototype is included in the standard input and output header file "Stdio.h" for receiving keyboard input content.
The scanf function is a blocking function
Blocking function: After the function executes, it waits for the user to enter, and if the user does not enter anything, he waits
Format: scanf ("Format control string", entry address list);
The address of a variable in the C language can be obtained by the address operator &. For example: Define int A; The address of a is &a.
code example
#include <stdio.h>
int main (int argc, const char*argv[]) {
Enter a person's age from the keyboard and print it out
Define a variable
int age;
Prompt the user for an age
printf ("Please enter a person's age: \ n")
Put the user input value into the age variable
scanf ("%d", &age);
Print the age of user input
printf ("%d", age);
return 0;
}
Dark Horse Programmer---iOS learning log 6