Formatted Input Using scanf
Used to input formatted data using conversion specifiers similar to printf
char ch;
char buf[80];
int val1, val2;
float rate;
scanf(“%c”, &ch);
scanf(“%s”, buf);
scanf(“%d %d”, &val1, &val2);
scanf(“%f”, &rate);
printf(“%c %s %d %d %f\n”, ch, buf, val1, val2, rate);
Previous slide
Next slide
Back to first slide
View graphic version