GDB doesn't print the variable value instantly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

GDB doesn't print the variable value instantly

Sanjeev C
If I am asking user to input a value using scanf function and later try to print it. It prints the value at the end of program. I'm not sure if it's a bug or intended.

int main()
{
int i;
scanf("%d", &i);
printf("Value is"); - Prints instantly
printf("%d", i); - Prints at the end of program
return 0;
}

This behaviour is when I'm running the program through gdb.