#include <stdio.h>
main(){
int i = 3;
if(i){
printf(" i is nonzero. \n");
}
}
#include <stdio.h>
main(){
int i = 0;
if(i){
printf(" i is nonzero. \n");
}else{
printf("i = 0");
}
}
在C语言中,0算假,非0都是真。
#include <stdio.h>
main(){
int i = 3;
if(i){
printf(" i is nonzero. \n");
}
}
#include <stdio.h>
main(){
int i = 0;
if(i){
printf(" i is nonzero. \n");
}else{
printf("i = 0");
}
}