Input Format Descriptors
#include <stdio.h>
main()
{
char s[3], t[30], u[30];
int i;
float f;
scanf("%c", s);
scanf(" %2d%4s%4f", &i, t, &f);
scanf(" \"%[^\"]\"", u);
printf("%d, %f, %c, %s, %s\n",
i, f, s[0], t, u);
}
Input:
a
44mice2.97
"string"
Output:
44, 2.970000, a, mice, string
This is program
pg453.c
Previous slide
Next slide
Back to first slide
View graphic version