-
doubts on scanf
My doubts ....
1.
Code:
int main(void)
{
int i;
scanf("%d", &i,&i);
printf("%d",i);
}
Why doesn't the scanf stmt show any error?
2.
Code:
int main(void)
{
int i;
scanf(" ",&i);
printf("%d",i);
}
This too doesn't show any errors.on the contrary the scanf stmt asks for input even though it does not retain the value keyed in. Why?
-
Because the compiler doesn't know any better as scanf() has to process the parameters you give it. Get it wrong, and its your fault, and the program will most likely crash and burn.