UMBC CS 201, Spring 02
UMBC CMSC 201 Spring '02 CSEE | 201 | 201 S'02 | lectures | news | help

scanf

You have been using the function scanf from the stdio library since the beginning of this course, but I have been sheilding you from scanf's peculiarities by providing specific kinds of input.

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.


CSEE | 201 | 201 S'02 | lectures | news | help

Thursday, 17-Jan-2002 13:52:24 EST