循环运行多少次?

时间:2022-04-13 23:54:46
int main()
{
 for(;;) {
      printf("INSIDE FOR LOOP");
      return 0;
     }
}

How many times is the printf statement gonna be printed? and why?

printf语句要打印多少次?为什么?

2 个解决方案

#1


3  

The statement is printed 1 time. The return exits the loop and the program.

该声明打印一次。返回退出循环和程序。

#2


-4  

It loops forever because there is no condition (what normally goes between the ;;).

它永远循环,因为没有条件(通常在;;之间)。

#1


3  

The statement is printed 1 time. The return exits the loop and the program.

该声明打印一次。返回退出循环和程序。

#2


-4  

It loops forever because there is no condition (what normally goes between the ;;).

它永远循环,因为没有条件(通常在;;之间)。