Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +917541905230, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec

Sunday, November 29, 2020

Infinite loop in C

Infinite for loop: is the one which goes on repeatedly for infinite times. This can happen in two cases.

Infinite loop in C | welcome2protec.com

Infinite for loop:

An infinite for loop is the one which goes on repeatedly for infinite times. This can happen in two cases:

1) When the loop has no expressions.

for(;;)
{
 printf("Welcome2Protec");
}

The above code runs infinite times because there is no test expression to terminate the loop. Hence, Welcome2Protec gets printed infinite times.

2) When the test condition never becomes false.

for(i=1;i<=5;)
{
 printf("Welcome2Protec");
}

In the above case, the statement Welcom2Protec gets printed infinite times because the test condition never becomes false. The value of i remains the same because it is never updated and thus the value of i remains smaller than 5 for each iteration.


Empty for loop

An empty for loop is the one which has got no body. In simple words, it contains no statements or expressions in its body. It can be used for time-consuming purposes. Each iteration takes its own time for compilation and execution. Usually, it is too small to be of any significant importance. Here’s the syntax of an empty for loop:

for(i=1;i<=5;i++)
{}


More on this to be updated soon...




Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +966532621401, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec

Help others by sharing this page.

Ahmad Irshad

Author & Editor

I love blogging, teaching, learning computer science and sharing it to others. I've written and develped this site so that students may learn computer science related tutorials eaisly. MCA / MCITP

0 Comments:

Post a Comment

Please don't enter any spam link in the comment box.


Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +966532621401, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec
Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec
Contact Us