Purchase Solution

evaluate the operands in the expression

Not what you're looking for?

Ask Custom Question

What are the values of sum1 and sum2?
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 = (I / 2) + fun(&i);
sum2 - fun(&j) + (j / 2);
}

What are the values of sum1 and sum2

a. if the operands in the expressions are evaluated left to right?
b. If the operands in the expressions are evaluated right to left?

Purchase this Solution

Solution Summary

It evaluates the operands in the expression.

Solution Preview

a. if the operands in the expressions are evaluated left to right?

sum1 = 46;
sum2 = 48;

Code:

int fun(int *k) {
*k += 4;
return 3 * (*k) - 1;
}

void main()
{
int i ...

Purchase this Solution


Free BrainMass Quizzes
Probability Quiz

Some questions on probability

Geometry - Real Life Application Problems

Understanding of how geometry applies to in real-world contexts

Exponential Expressions

In this quiz, you will have a chance to practice basic terminology of exponential expressions and how to evaluate them.

Multiplying Complex Numbers

This is a short quiz to check your understanding of multiplication of complex numbers in rectangular form.

Solving quadratic inequalities

This quiz test you on how well you are familiar with solving quadratic inequalities.