How to make an infinite loop in C .If I am using while for example??
Printable View
How to make an infinite loop in C .If I am using while for example??
Code:while (1) {
printf("forever");
}
Thanks!
That perfectly worked ;)
Code:for(;;)
{
printf("Alternative infinite loop.\n");
}
Code:Loop:
printf( "Infinite loop with goto." );
goto Loop;
I like doing it this way:
Code:#define forever while(1)
forever {
printf("loop\n");
}
I do not think it is worth the trouble though. for (;;) and while (1) are universally recognised as deliberate infinite loops.Quote:
I like doing it this way:
Thanks guys ;) You are all great!! and so are your suggestions ;)