Question
Chapter 4 5. Show the output produced by each of the following program fragments. Assume that i and j are int variables. (a) i =
Chapter 4
5. Show the output produced by each of the following program fragments. Assume that i and j are int variables.
(a) i = 5; j = ++i * 3 - 2;
printf("%d %d", i, j);
(b) i = 5; j = 3 - 2 * i++;
printf("%d %d", i, j);
(c) i = 7; j = 3 * i-- + 2;
printf("%d %d", i, j);
(d) i = 7; j = 3 + --i * 2;
printf("%d %d", i, j);
4.4
6. Supply parenthesis to show how a C compiler would interpret each of the following expressions.
(a) a * b - c * d + e
(b) a / b % c / d
(c) - a - b + c - + d
(d) a * - b / c - d
4.5
7. Give the values of i and j after each of the following expression statements has been executed. (Assume that i has the value 1 initially and j has the value 2.)
(a) i += j;
(b) i--;
(c) i * j / i;
(d) i % ++j;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started