c语言中什么都不执行的表达式语句

 

001、

[root@PC1 test]# ls
test.c
[root@PC1 test]# cat test.c
#include <stdio.h>

int main(void)
{
        int i;

        puts("please input an integer.");
        printf("i = "); scanf("%d", &i);

        int j;
        j = i;

        while(i >= 1)
        {
                printf("%d ", i--);
        }

        (j > 0) ? printf("\n"):0;        // 什么都不执行的语句,一个0数字即可。

        return 0;
}
[root@PC1 test]# gcc test.c -o kkk
[root@PC1 test]# ls
kkk  test.c
[root@PC1 test]# ./kkk
please input an integer.
i = 2
2 1
[root@PC1 test]# ./kkk
please input an integer.
i = -3

 。

 

posted @ 2024-09-20 13:07  小鲨鱼2018  阅读(0)  评论(0编辑  收藏  举报