+ 1
How to break an infinite loop
4 Answers
+ 6
Use the 'break;' keyword.
For example:
int a = 0;
while (true){
a++;
if(a==7)
break;
}
+ 5
PRAMOD JANA it would be an infinite loop without the break
0
we can call this infinite loop
int a=0;
while (true)
{
printf ("infinite ");
}
- 1
the example which you have given above is not an infinite loop