difference between two for loops in C?

The only difference I see is the “i++” part. That increments i in the first loop, but it doesn’t increment in the second loop. Unless n<=0, the second loop will never end. This is called an infinite loop.

I’d highly recommend reading more on loops with C:

http://www.tutorialspoint.com/cprogramming/c_loops.htm

http://www.codingunit.com/c-tutorial-for-loop-while-loop-break-and-continue

Leave a Comment