If you want to create an infinite loop you can use for and while loop easily. For create an infinite loop by using for loop, you can not give any initialization, increment and condition into for loop. For example:
for ( ; ; )
{
Printf (“finite loop”);
}
When you run this program you can not exit this for loop normally. For exit this program uses ctrl+Break.
For create an infinite loop by using while loop you can use this formula,
While(1)
{
Printf(“finite loop”);
}
When you run this program you can not exit this for loop normally. For exit this program uses ctrl+Break.
Written by arnob.
while(2) is this is a infinite loop??
উত্তরমুছুন