|
|
1.1 ! root 1: ! 2: ! 3: for C Keyword for ! 4: ! 5: ! 6: ! 7: ! 8: Control a loop ! 9: ! 10: ffoorr(_i_n_i_t_i_a_l_i_z_a_t_i_o_n; _e_n_d_c_o_n_d_i_t_i_o_n; _m_o_d_i_f_i_c_a_t_i_o_n) ! 11: ! 12: for is a C keyword that introduces a loop. It takes three ar- ! 13: guments, which are separated by semicolons `;'. initialization ! 14: is executed before the loop begins. endcondition describes the ! 15: condition that ends the loop. modification is a statement that ! 16: modifies variable to control the number of iterations of the ! 17: loop. For example, ! 18: ! 19: ! 20: for (i=0; i<10; i++) ! 21: ! 22: ! 23: first sets the variable i to zero; then it declares that the loop ! 24: will continue as long as i remains less than ten; and finally, ! 25: increments i by one after every iteration of the loop. This en- ! 26: sures that the loop will iterate exactly ten times (from i==0 ! 27: through i==9). The statement ! 28: ! 29: ! 30: for(;;) ! 31: ! 32: ! 33: will loop until its execution is interrupted by a break, goto, or ! 34: return statement. Also, either or both of initialization and ! 35: modification may consist of multiple statements that are ! 36: separated by commas. For example, ! 37: ! 38: ! 39: for (i=0, j=0; i<10; i++, j++) ! 40: ! 41: ! 42: initializes both i and j, and increments both with each iteration ! 43: of the loop. ! 44: ! 45: ***** See Also ***** ! 46: ! 47: break, C keywords, continue, while ! 48: ! 49: ! 50: ! 51: ! 52: ! 53: ! 54: ! 55: ! 56: ! 57: ! 58: ! 59: ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.