难道这两个意思不一样,首先得到价值再增加?
for ( ; *s == *t; s++, t++)
for ( ; *s++ == *t++;)
Run Code Online (Sandbox Code Playgroud)
如果for循环具有引用s和的内容,则为否t.第一个循环可以重写为
while (true)
{
bool are_equal = *s == *t;
if (!are_equal) break;
// Perform stuff inside the for loop
// Note that 's' and 't' are not increased yet in here.
++ s;
++ t;
}
Run Code Online (Sandbox Code Playgroud)
第二个循环可以重写为
while (true)
{
bool are_equal = *s == *t;
++ s;
++ t;
if (!are_equal) break;
// Perform stuff inside the for loop
// Note that 's' and 't' have been increased in here.
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
152 次 |
| 最近记录: |