我正在学习C并且作为练习,我正在尝试编写一个没有任何分号的简单程序.我在替换return 0语句方面遇到了一些麻烦,但我发现这是(唯一的)方法在C:中做到这一点if(exit(0),0){}.
这个陈述究竟是如何运作的?
我知道,exit()从stdlib一个void函数,但我不明白是什么,0在部分if作品(其余的我很清楚).
给出以下代码:
// this is a solution of uva 12279
#include<stdio.h>
int main()
{
int arr[10000],i,n,a,d=0,e=75;
while(scanf("%d",&n),n)// what's that means?
{
d++;
int c=0,b=0;
if(n==0)
return 0;
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
for(i=0;i<n;i++)//this is for loop
{
if(arr[i]==0)
c++;
else
b++;
}
a=b-c;
printf("Case %d: %d\n",d,a);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
是什么意思while(scanf("%d",&n),n)?