What will be the output of the following C programming code:void main()
{
int *i, a=12, b=2, c;
c = (a=a+b, b=a/b, a=a*b, b=a-b);
i = &c;
printf("%d", --(*i));
}
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. 90
Explanation
The comma operator evaluates left to right and yields the last value: a = 14, b = 14/2 = 7, a = 14×7 = 98, b = 98 − 7 = 91, so c = 91. --(*i) pre-decrements c to 90 and prints 90.More Programming Languages and Computer Graphics questions
- Only legal pointer operations: A. pointer + number → pointer B. pointer − number → number C. pointer + pointer → pointer D. pointer − point…
- Consider the operators used in C Programming given below: A. && B. += C. >> D. >= E. ?: Choose the correct order of precedence of the opera…
- Consider the conditional statement if (m == 20 − 10 || n > 10). The order of execution of the following operations is A. == B. − C. || D. >…
- Which of the following is NOT true about Global Variables?
- Arrange the 2-D viewing transformation pipeline. A. Convert world coordinates to viewing coordinates B. Map viewing coordinates to normaliz…
- The entire set of parameters, including the return address, that is stored for a procedure invocation is referred to as