hangfrieddays 发表于 2022-3-5 15:28:54

过不了编译

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i=6;
    ​do{

    printf("%d",i--);
    }while(0);
    return 0;
}
这个为什么过不了编译呢

isdkz 发表于 2022-3-5 15:31:04

本帖最后由 isdkz 于 2022-3-5 15:38 编辑

我这里能通过编译,你那里报什么错?#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i=6;
    do{

    printf("%d",i--);
    }while(i);
    return 0;
}

傻眼貓咪 发表于 2022-3-5 15:31:52

本帖最后由 傻眼貓咪 于 2022-3-5 15:34 编辑

while(0) 改成 while(1)
另外需要退出循环条件

hangfrieddays 发表于 2022-3-5 15:37:23

找到了,是codeblocks的问题
页: [1]
查看完整版本: 过不了编译