小编Kru*_*nal的帖子

C中y = x ++ <= 2的含义是什么?

我在C语言中有以下代码片段.

int main()
{
    int x = 1, y = 1;
    for( ; y ; printf("%d %d  ", x, y))
    {
        y = x++ <= 2;
    }
    printf("\n");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

它给出了类似的输出

2  1
3  1
4  0
Run Code Online (Sandbox Code Playgroud)

我不明白输出和含义y = x++ <= 2.

c for-loop

3
推荐指数
3
解决办法
864
查看次数

标签 统计

c ×1

for-loop ×1