scanf("%vartype", &varname);
Basically the same syntax as printf(). However, remember to include the address-of operator, &.
example:
#include <stdio.h>
int main( void )
{
int age;
printf( "How old are you?\n" );
scanf ( "%d", &age );
printf( "\nYou are %d years old", age );
return 0;
}
output:
How old are you?
10
You are 10 years old
<edit>
Pretender: Beat me by a minute!
</edit>