23 while loop


  • syntax
    while ( condition )
    {
        /* statement */
    }

  • ควรตรวจดูให้แน่ใจว่า condition จะไม่เป็น infinite loop หรือการวนลูปที่ไม่มีสิ้นสุด

#include <stdio.h>
#include <limits.h>
int main(void)
{
printf("%d",INT_MAX);
//while
int i;
i = 2147483640;
while(i > 0)
{
printf("%d\n",i);
i++;
}
return 0;
}
view raw B23_WhileLoop.c hosted with ❤ by GitHub