
10 Data Structures Using C
Obviously, the output of the above set of statements would be:
e rst alphabet is: A.
The other specifiers which can be used in printf() function are given in Appendix B.
1.6.2 How to Read Data from Keyboard Using scanf()
Similar to printf() function, scanf() function also uses the %d, %f, %c, and other format specifiers
to specify the kind of data to be read from the keyboard.
However, it expects the programmer to prefix the address operator `&’ to every variable written in
the argument list as shown below:
int roll;
scanf (“%d”, & roll);
The above set of statements declares the variable roll of type int, and reads the ...