语言:C
如果输入 0,则布尔表达式输出 0,否则输出 1。
按照上面的说法,
情况1:
输入
#include <stdio.h>
#include <stdbool.h>
main()
{
int a = 1,
b = 2;
bool res = ((a == b) && ("your "));
printf("res = %d", res);
}
输出
res = 0
案例二:
输入
bool res = (!(a == b) && ("your "));
printf("res = %d", res);
输出
res = 1
案例3: 现在我将prinf函数添加到(“你的”)
输入
bool res = ((a == b) && printf("your "));
printf("res = %d", res);
输出
res = 0 //adding printf doesn't change the output
案例4: 输入
bool res = (!(a == b) && printf("your "));
printf("res = %d", res);
输出
your res = 1 // i expected just "res = 1" not "your res = 1"
打印功能如何不在CASE 3中执行但在CASE 4中执行?