I/O in C (printf and scanf)
printf()
We have already touched base with printf(). We know that the header file <stdio.h> contains information about the
printf output routine.
scanf()
<stdio.h> also contains information about the routine that is used to get user inputs to a C program, scanf().
The same I/O directives are used with scanf() for the different data types.
Here's an example
#include <stdio.h>
void main( ) { int a; char b; printf("Enter an int and a char: "); scanf("%d %c", &a, &b); printf("You entered %d, %c\n", a, b); }
Here's the output
Enter an int and a char: <user enters33 x>
You entered 33, x