C语言break语句

break语句只会让跳出本函数

输出一个hello world

#include <stdio.h>

int main()
{
  int a = 1;
  while(a)
  {
    if(!a) break;
    printf("hello world");
    break;
  }
  return 0;
}

不停的输出hello world

#include <stdio.h>

int main()
{
  int a = 1;
  while(a)
  {
    if(!a) break;
    printf("hello world");
  }
  return 0;
}

猜你喜欢

转载自www.cnblogs.com/toooney/p/10926353.html