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

  Provide an abstraction for a network card

Following this pattern, provide an abstraction for a network card.

  Program to display temperature in table

Write down a C program that accepts three numbers input by the user, and outputs a table of the temperatures in Celsius, Fahrenheit, and Kelvin.

  What variety of cable will work to make an association

What variety of cable will work to make an association

  Translate following c++ program to pep/8 assembly language

Translate following C++ program to Pep/8 assembly language

  Define some uses of this instruction

Many instruction sets include the instruction NOOP, meaning no operation, which has no effect on the processor state other than incrementing the program counter Suggest some uses of this instruction.

  Discuss the different types of project feasibility factors

List and discuss the different types of project feasibility factors.

  Explain the action of the function

Describer the action of the function. What is the function in the library that performs a similar calculation.

  How to draw a hierarchy chart

How to draw a hierarchy chart

  How quick kruskal''s algorithm run

imagine that all edge weights in a graph are integers in the range from 1 to |V|.how quick Kruskal's algorithm run.

  What type of procedures might a company put into place

What are some common steps and what type of procedures might a company put into place.

  Program for translates letter grade into number grade

Write down a program which translates the letter grade into number grade.

  Developing the java program

Create a block utilizing a loop which will calculate the number of items which can be purchased on the basis of price of the item and total amount available to spend.

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