When I run my program using scanf() none of my prior print statements print (scanf() statement is at end of program after a printf() statement), it is only when I input something that my program will begin to run and print everything out that was initially supposed to be printed before the input was taken (even though nothing will print before hand). I am using the gcc compiler through a gitbash terminal just using input from the terminal (no files or nothing).
When I remove my the scanf() statement from the end of my program the program runs fine and everything prints as it should. Once I put the scanf() statement at the end of my program (after the printf() statements) and run it, nothing will print until I enter some sort of input. My program is essentially:
printf("blah blah blah");
int getInput;
scanf("%d", &getInput);
When I go to terminal and enter gcc filename.c and then ./a to run the executable, the cursor just blinks signifying that the program is running but no print statement is printed. It is only when I enter a number into the terminal and press enter that the print statement is printed to the terminal. I was hoping to have the print statement print before any input is required. I have attached three screenshots to further show my dilemma. Image of the code that I am running Image of what terminal looks like after I compile and run Shows that I must enter input for program to execute