float h;
int ch;
while (1) {
scanf("%f", &h);
while ((ch = getchar()) != '\n')
putchar(ch);
putchar('\n');
printf("%f\n", h);
}
return 0;
}
someone help me with this please. why does scanf accept the first two characters of any n word?
sample console
nword
ord
0.000000
nibba
bba
0.000000
n1234
234
0.000000
the value of the float remains garbage, i tested multiple times.
scanf's return value is 0 as well. why does it accept the two characters then ;__;
when you people are done, please help me with scanf's racism
The likely case is that scanf is not required to put back what it reads in the stream
Обсуждают сегодня