Answer:
Note: The program won’t compile if “#include” statement is not followed by included library <stdio.h>
“printf” function outputs text in quotes which is the first argument and next arguments in place of specificators which starts with percent ‘%’ symbol in text. ‘\n’ is an escape sequence for new line, and ‘%d’ is specificator of decimal integer. Therefore, what will be outputted is new line, then space, integer, space, integer, space and an integer.
The first integer is x!=15, which is actually a Boolean value received from comparing x and 15. Since x equals 15 and != stands for “not equal” the comparing results in false. When false Boolean value is casted into integer it becomes zero, thus, the first integer is 0.
The second integer is x=20, which is a result of assigning x to 20. The result of assigning is the assigned value itself, thus, the second integer is 20.
The third integer is x<30, which is actually a Boolean value received from comparing x and 20. Since x equals 20 (not 15, because of the assignment in previous argument) and < stands for “less than” the comparing results in true. When true Boolean value is casted into integer it becomes one, thus, the first integer is 1.
Thus, the program outputs new line, space, 0, space, 20, space, 1.
Comments
Leave a comment