language: C
a bool expression outputs 0 if 0 is entered, else 1 will be the output.
following the above statement,
CASE 1:
input
#include <stdio.h>
#include <stdbool.h>
main()
{
int a = 1,
b = 2;
bool res = ((a == b) && ("your "));
printf("res = %d", res);
}
output
res = 0
CASE 2:
input
bool res = (!(a == b) && ("your "));
printf("res = %d", res);
output
res = 1
CASE 3: now i add prinf function to ("your ")
input
bool res = ((a == b) && printf("your "));
printf("res = %d", res);
output
res = 0 //adding printf doesn't change the output
CASE 4: input
bool res = (!(a == b) && printf("your "));
printf("res = %d", res);
output
your res = 1 // i expected just "res = 1" not "your res = 1"
how is the print function not executed in CASE 3 but executed in CASE 4?