p017forloop

#include <stdio.h>

int main (int argc, const char * argv[])

{

    /* Demonstrating a for loop

     Notice that the counting variable defined in the scope of the for loop is confined to the for loop

     

     Feel free to play around with the code and try out other forms of flow control

     */

    

    printf("\n");

    

    int i = 100;

    

    for (int i = 0; i < 5; i++) {

        printf("Looping: i is %i\n", i);

    }

    

    printf("Outside the loop; i is %i\n\n", i);

    

    

    

    return 0;

}



Looping: i is 0
Looping: i is 1
Looping: i is 2
Looping: i is 3
Looping: i is 4
Outside the loop; i is 100

posted on 2011-09-01 23:37  upwifi  阅读(108)  评论(0)    收藏  举报

导航