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

  Writing into file utilizing fileinputstream

Write down an application utilizing the FileInputStream which opens a file which consists of the name of user's favourite book and then show it to the user.

  What is the gain of using rule sets

What is the gain of using rule sets

  Finding domain name available to company

Use the Internet resources in order to determine which domain name is available to company. Judge if you would use a .com, .org, or .net for the Web address.

  Related to investment in stock group

Specify the minimum amount Trader must invest in each stock group in order to achieve the investment goal?

  Installing the new network

You have been hired as an IT Consultant in order to assist Good Nature food market with developing and implementing the new network. They have hired you to find what type of network they required and to install the network.

  Explain how vb .net uses a database

express how VB .NET uses a database. Briefly summarize the components of a database and the characteristics of a DBMS. Include a discussion of ADO .NET and its capabilities.

  Define what situations are appropriate for hard disks

define what situations are appropriate for Tape. Explain why.define what situations are appropriate for hard disks. Explain why.

  What is the cookie

What is a cookie? What are advantages and disadvantages of using cookies in a web application.

  Software measurement and software metrics

Explain whether the software measurement is equivalent to the software metrics? What makes them different? Explain the common software metrics which you already know, heard about or used?

  Program has to convert feet into meters

The program must also convert feet into meters. The program prompts the user to enter a number in feet, converts it to meters, and displays the result. One foot is 0.305 meters.

  Ai and intelligent agents supporting knowledge management

Explain how the AI and intelligent agents provide support to the knowledge management. Explain it in the 1 paragraph with source.

  Why the technique is called a bubble sort

Write down a program that implements a method that receives an array parameter and sorts that array using the bubble-sort algorithm.. why The technique is called a bubble sort.

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