UMBC CS 201, Fall 06
UMBC CMSC 201
Fall '06

CSEE | 201 | 201 F'06 | 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 F'06 | lectures | news | help

Tuesday, 22-Aug-2006 07:14:18 EDT