C language — to solve the problem of program flashback when programming (in VS)

How can we make the application pause so that we can see the effect
First let’s use a simple program to explain the flashback problem, when we run the following program, we do not see the actual display effect
We can only see the result if we pause the program, so how do we pause the program?We will solve this problem in three ways.

Return 0; return 0; Add getchar() to the preceding line;
This function is waiting for input of a character, not input will always wait, so play a pause effect, to exit any key can!

View the results after running: press any key to exit after running

Return 0; return 0; I’m going to add while(1) to the front line;
Infinite loops don’t let you quit the program, you’re stuck here all the time, which is very useful. The only way to exit the program is to click the close button X in the black window in the upper right corner

View the results after running, only click the close button to end the program running.

Third, you need a special Windows header file and then add the statement system (” pause “).
Note: this method is more time-consuming, more harmful, try not to use this method

The result of operation,

 

Read More: