This was most unexpected. I have a big program which was behaving strangely so I decided to test out each section. I wrote a small program as shown below:
The program prints:Code:#include <stdio.h> int main() { printf("go"); float a; scanf("Enter LTP", &a); printf("TheLTPis%f", a); return 0; }
I then types in 1.344444Code:go
The output continues:
The output always stays the same.Code:The LTPisnanPress any key to continue...
What is happening there? I've used scanf hundreds of times yet I cant see what is presumably a very simple mistake. Any ideas?



LinkBack URL
About LinkBacks


