c语言中while如何用

c语言中while如何用

C语言while的用法

while语句主要是作为循环

如需循环打印hello word;建立一个hello.txt文本文件

在hello.txt记事本内写入:

#include

int main()

{

while (1)

{

printf("hello word\n");

};

};

保存记事本后,将hello.txt保存为hello.c

在cmd窗口输入gcc hello.c命令后会默认生成一个a.exe的文件

鼠标双击a.exe,会循环打印hello word