57.0k views
4 votes
Consider the following C program: int fun(int *i) { *i += 5; return 4; } void main() { int x = 3; x = x + fun(&x); } What is the value of x after the assignment statement in main, assuming a. operands are evaluated left to right. b. operands are evaluated right to left

1 Answer

3 votes

Answer:

a. operands are evaluated left to right

7

b.operands are evaluated right to left

12

Step-by-step explanation:

for a

x value is 3 and function returning 4 so total 7

for b

function value returning 4 and it also changes x value to 8

so when we add both it is 12

User Agurchand
by
5.0k points