Showing posts with label gets. Show all posts
Showing posts with label gets. Show all posts

02 May 2012

scanf and gets

scanf

scanf is used to allow a program to get data from the keyboard.

int input;
printf("Please enter an integer");
scanf("%d%*c", &input);

These instructions will display a prompt to the operator and then stop the program until the operator keys in an integer and presses <Enter>. The integer entered will be stored in the variable named "input".