发布网友 发布时间:2022-04-20 02:37
共2个回答
热心网友 时间:2023-07-18 15:19
比如
for(i = 0; i < 5; i++)先执行i=0,读取i<5的逻辑值为1,则为真,再开始内层循环。内层从j=0一直到j=4循环一整遍之后再执行i++,然后i=1<5,再把内层从j=0一直到j=4循环一整遍,如此循环。
执行结果如下(Code::blocks)
i = 0, j = 0
i = 0, j = 1
i = 0, j = 2
i = 0, j = 3
i = 0, j = 4
i = 1, j = 0
i = 1, j = 1
i = 1, j = 2
i = 1, j = 3
i = 1, j = 4
i = 2, j = 0
i = 2, j = 1
i = 2, j = 2
i = 2, j = 3
i = 2, j = 4
i = 3, j = 0
i = 3, j = 1
i = 3, j = 2
i = 3, j = 3
i = 3, j = 4
i = 4, j = 0
i = 4, j = 1
i = 4, j = 2
i = 4, j = 3
i = 4, j = 4
Process returned 0 (0x0) execution time : 0.113 s
Press any key to continue.
热心网友 时间:2023-07-18 15:19
进入外层循环后,