printf() and scanf() in C — a practical guide to C printf scanf with clear examples you can reuse in real projects.
C Programming Tutorial Series (17/102). Prefer one article? Read the complete C programming tutorial.
Short description
scanf with %s is overflow-prone — prefer width limits or fgets.
printf/scanf
int age;
printf("Age: ");
if (scanf("%d", &age) == 1) {
printf("You are %dn", age);
}