View Full Version : scanf not reading input correctly

8th January 2006, 15:34
I wrote a program:

int main(void) {
double iiput;
printf("\n\nEnter a degree value: ");
scanf("%14.10f", &iiput);
printf("%14.10f\n", iiput);}
and the user-machine interaction upon compiling this was:

Enter a degree value: 200.5896113248
Please explain what I am doing wrong?
Thank you.

8th January 2006, 15:54
Make sure that you have all warnings turned on when you compile your program, then the compiler will tell what might be wrong:
$ gcc -Wall a.c
a.c: In function `main':
a.c:6: warning: unknown conversion type character `.' in format
a.c:6: warning: too many arguments for format
a.c:7: warning: control reaches end of non-void function

scanf("%lf", &iiput);