Sentinel loops

In sentinel loops we don’t know that how many no. of times the loop will work!

That means that a sentinel loop can be regarded as infinite, indefinite loop.

For Eg:

main()

{

int x=1;

while (x=1)

{

printf("This is an infinite loop!");

}

}

 

Output will be an infinite loop printing “This is an infinite loop!” infinitely!! 🙂

Leave a Reply

Your email address will not be published.