current position:Home>Problems related to C language selection structure if else

Problems related to C language selection structure if else

2022-02-02 20:16:41 CSDN Q & A

The phenomenon and background of the problem

Selection structure

if Note that any value is true or false #include <stdio.h>int main(){    if(0){        printf(" Yes if");    }else{        printf(" Yes else"); //  Be performed     }}
Operation results and error reporting contents

if(1) Output if if(0) Output else

My solution ideas and tried methods
#include <stdio.h>int main(){    **if(0){**

Judge the selection result 1 It's true 0 For false ? Personal speculation, please give me some advice




Refer to the answer 1:

0 For false Not 0 It's true

img




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022016399949.html

Random recommended