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:
Code:
#include <stdio.h>
int main() {
printf("go");
float a;
scanf("Enter LTP", &a);
printf("TheLTPis%f", a);
return 0;
}
The program prints:
I then types in 1.344444
The output continues:
Code:
The LTPisnanPress any key to continue...
The output always stays the same.
What is happening there? I've used scanf hundreds of times yet I cant see what is presumably a very simple mistake. Any ideas?