Thread: not sure how to say this...

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You know that a for loop commonly looks like:
    Code:
    for (int i = 0; i < something; i++)
    HOWEVER, a for loop is NOT limited to this. In fact, a for loop is not a limited syntax. A for loop looks like:
    Code:
    for (<declarations>; <condition>; <to do after each loop>)
    So we can make loops such as:
    Code:
    for (int i = 0, j = 0; i < 0 && j > 0; i++, j--)
    Or
    Code:
    for (;myvar == 0;)
    Or even
    Code:
    for(;;)
    I simply wanted to point this out. If you don't want to increase i or have more control over i each iterator, you are not limited to using a while loop. No, a for loop could still do fine.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Yeah, that's true. Besides a "while" can be written with "for" like:
    Code:
    for (;condition;)

Popular pages Recent additions subscribe to a feed