UMBC CMSC 201 Fall '05 CSEE | 201 | 201 F'05 | lectures | news | help |
The function scanf() is analogous to printf() in that it has a "format string" and a set of variables, one for each code in the "format string.
scanf("%d", &n) ; scanf("%d%d", &n, &m) ;Of course, it reads from the standard input rather than writing to the standard output.
The function scanf takes pointers to variables as parameters (parameters passed by reference) so it can store the user's input in those variables.