What are values of sum1 and sum2

Assignment Help Computer Engineering
Reference no: EM1331248

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?

Now the answers are: 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? 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? Sum1=46, Sum2=48
b. If the operands in the expressions are evaluated right to left? Sum1=48, Sum2=46

Reference no: EM1331248

Questions Cloud

Using computer information systems for medical records : Can you please describe any new legal problems that you see emerging in the future as a result of the widespread use of computer information systems in regards to medical records?
Key trait theories of leadership : Can you identify the key trait theories of leadership and give a brief description of them? If possible can you say which ones, if any, are used nowadays.
Expecting an entitlement of ownership : Do you think that customers are not expecting an entitlement of ownership when they purchase a service or consumers should not be expecting satisfaction from a service not owned?
Annotated bibliography on hrm technologies : Annotated Bibliography on HRM Technologies - The annotated bibliography and resource list provides the opportunity to conduct a literature search concerning existing and possible HRM technologies that can be used in organizations.
What are values of sum1 and sum2 : If the operands in expressions are evaluated left to right. If the operands in the expressions are evaluated right to left? Sum1=48, Sum2=46
Business and cite the opinions of some experts : Are HR workers informed about other areas of the business and Cite the opinions of some experts (journals, etc.) who talk about the issue of how HR can be better integrated with the other actual business areas of an organization.
Illustrate are some of the clever strategies : Illustrate are some of the clever strategies that landlords might use to create a black market.
Equal employment opportunity commission : Explain how the complaint begins with the Equal Employment Opportunity Commission (EEOC) and proceeds through the civil litigation process from the state level up to the United States Supreme Court.
Define the term mixed method design : Define the term mixed method design and identify the advantages and disadvantages of using such a design.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Assuring the snmp security

Create an argument for modifying to the other version or staying with v1 and forming the essential modifications to assure the SNMP security the v1 requires.

  Cost estimate for the topliance corporation

You have already generated a project charter, a project schedule, and the cost estimate for the TopLiance Corporation, which sells home appliances. They have over 50 sales agents across multiple states.

  Define the divide-and-average algorithm

The divide-and-average algorithm for approximating the square root of any positive number a is as follows: Take any initial approximation x that is positive, and then find out a new approximation by calculating the average of x and a/x, that is, (..

  How many ways a committee of 4 people can be choosen

The question of how various ways a committee of 4 people can be selected from a group of 10 is known as a combination. The notation in general for counting the number of ways of selecting r items from a group of n is C(n,r) = n! / r!(n-r)!

  Express the worst case scenario for quick sort algorithm

express the worst case scenario for quick sort algorithm.

  The printed newspaper''s popularity is declining

Some people lament the fact that the printed newspaper's popularity is declining so alarmingly that some of the children of the new generations have never read (or will read) a printed newspaper.

  Which language would be more appropriate

The vehicle registration department for the State of Florida is becoming decentralized. Each county would now handle its own registration process and will issue its own license plates

  Baseline for the linux system

Describe briefly the purpose of the baseline. Explain the areas of system would you involve in the baseline for your Linux system?

  Supply supporting evidence for the decision

Now that you have a normal plan and have identified the information that you need for this program, you feel you are ready to start development. You told your uncle that you would need to purchase software for this program. Since your uncle is in ..

  Estimating average access time of system

The hit ratio for read accesses only is 0.9. A write-through procedure is used. Explain the average access time of system taking only memory read cycles?

  Estimating the performance of processor

Without any hardware support, context switch time is not zero. This states that the actual performance will not be as good as the ideal above.

  Why a website would need to be redesigned

Why do you think it is important to always be planning the next site redesign for a company.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd