0

Please explain the flow friends

while running the code the output comes as 6.. I don"t know how the 6 comes. #include <stdio.h> int main() { int a=-3; a=-a-a+!a; printf ("%d\n",a); return 0; } Can anyone say how it comes???

13th Aug 2018, 12:38 PM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
2 Respostas
+ 1
a is -3 -a is 3 3 - (-3) = 6 then comes the confusing part, "+!a" in C, anything other than 0 is considered true, so "!a" equates to 0 6 + 0 = 6 thus the final result is 6
13th Aug 2018, 2:24 PM
hinanawi
hinanawi - avatar
+ 1
hinanawi thank you so much😊😊😊
19th Aug 2018, 4:55 PM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar