04. Let the function fun be defined as int fun(int * k) { } * k += 4; return 3* (*k) - 1; Suppose fun is used in a program as follows: void main() { } int i=10, j = 10, sum1, sum2; sum1 = (1/2) + fun( & i); sum2 = fun( & j)+(j / 2); What are the values of sum1 and sum2 If operands in the expressions are evaluated right to left?

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Please explain the steps to arrive at the solution thoroughly, i'm having difficulty understanding
(Рrоgrаmmіոg lаոguаgе соոсерts)

04. Let the function fun be defined as int
fun(int * k) {
}
* k += 4;
return 3* (*k) - 1;
Suppose fun is used in a program as follows:
void main() {
}
int i=10, j = 10, sum1, sum2;
sum1 = (1/2) + fun( & i);
sum2 = fun( & j)+(j / 2);
What are the values of sum1 and sum2
If operands in the expressions are evaluated right to left?
Transcribed Image Text:04. Let the function fun be defined as int fun(int * k) { } * k += 4; return 3* (*k) - 1; Suppose fun is used in a program as follows: void main() { } int i=10, j = 10, sum1, sum2; sum1 = (1/2) + fun( & i); sum2 = fun( & j)+(j / 2); What are the values of sum1 and sum2 If operands in the expressions are evaluated right to left?
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr