which condition leads to infinite for loop in c. code example

Example 1: how to make infinite loop in c

while( 1 ) { }
for( ;; ) { }//The way it works is very interesting I recommend looking it up.

// To stop the loop you can use the break keyword
// Like this
for( ;; )
{
	break; 
}

Example 2: how to start infinite loop in c

//to start infinite loop set a variable that doesnt change
int flag=1;
while(flag==1)
{
	//enter code here
    //type condition for when you want to end loop
    	//type code
    	//change value of flag
        flag=2;
}

Tags:

C Example