VC++ if statement application range analysis

  • 2020-04-02 02:33:11
  • OfStack

The example of this article succinctly illustrates the application scope of IF in VC++, through a section of IF program code, to explain the execution rule of IF statement, to see this simple test code in detail:


# include <stdio.h>
int main(void)
{
 if (1 > 2)
 printf("AAAAn");
 printf("BBBBn");
 return 0;
}

Believe that there are many readers after the first look will think that the result of the program is 0, and in fact this section of the program code in Vc++6.0 output result is: BBBB.

It can be seen that if by default can only control the execution or non-execution of one statement, rather than select a statement to execute, which is usually the last statement to execute.

It is hoped that the examples described in this paper will be helpful for readers to understand the principle and usage of if statement in VC++.


Related articles: