2. scanf
• Usually input statement is used in C is scanf()
Syntax
• scanf (“control string”, &v1,&v2,&v3,…&vn);
• The control string must be a text enclosed in double quotes.
• It contains the data format of data being received.
• The ampersand & before each variable is an operator that specified the variable’s
names address and connecting it into internal representation in memory.
• Example for control string : integer (%d) , float (%f) , character (%c) or string (%s).
3. Printf()
•printf() function is used to print the “character, string, float, integer, octal and
hexadecimal values” onto the output screen.
•We use printf() function with %d , %f, %s forrmat specifier to display the value of
an variable.
•To generate a newline,we use “n” in printf() statement.
Syntax
printf (“outputstring identifiers(like %s,%d)”, variablenames);
Example
• printf(“hai hello%s”,name);
4. getchar()
• getchar is a function in C programming language that reads a single character.
getchar() function is used to get/read a character from keyboard input. When this
statement encountered the computer waits until key is pressed.
Syntax
Variable_name=getchar();
• Example
char name;
name = getchar();
5. putchar()
• putchar() function in C programming language which is used to write a character
on standard output/screen.
Syntax
putchar(variablename);
• Example
Choice=’y’;
putchar(Choice);