While trying to debug some C code I noticed that a printf() won't execute if placed before an infinite loop. Does anyone know why this is? Practically it's not that big of a deal, but for debugging it's a nightmare.
#include<stdio.h>
int main()
{
int data;
printf("This prints fine.\n");
printf("Enter data: ");
scanf("%d", &data);
printf("This should print but it doesn't.\n");
while(1)
{
//Infinite Loop
}
return 0;
}