Determine the value of p and q in program

Assignment Help Computer Engineering
Reference no: EM1322689

Write the output of the following program.

#include <iostream>
using namespace std;

int fun ( int*& p, int* q) {
*p = 12;
p = p+3;
q = p-1;
*q = *(p+1) + *q;
*p += 2;
cout << "p=" << *p << " q=" << *q << "n";
return (*q)%(*p);
}

int main( ) {
int y[5] = {1,2,3,4,5};
int* p = y;
int *q = new int;
*q = fun ( p, q );
for (int i=0; i<5; i++)
cout << y[i] << " ";
cout << "np=" << *p << " q=" << *q;
return 0;
}

Reference no: EM1322689

Questions Cloud

Deceptive tactic of consumer protections : In reviewing all of the consumer protections, classify the two most harmful to citizens if the protection did not exist. State your rationale with your answer.
Find the probability using pareto chart : Probability using Pareto chart - Evaluate the probability of randomly selecting an adult from the sample who doesn't always eat healthy foods because he or she has no time to cook or is confused about nutrition.
Probability of selecting a value at random : What is the probability of selecting a value at random and discovering that it has a value of less than 395 pounds?
How does stakeholder identification affect communication : How does stakeholder identification affect communication? Provide an example of how a similar message might be communicated to two different stakeholders.
Determine the value of p and q in program : Write the output of the following program. #include using namespace std; int fun ( int*& p, int* q) { *p = 12;
Decisions of a business nature : Even though she is an artisan, she will need to make decisions of a business nature. What decisions or evaluations may be especially diffi cult for her?
Probability-inverse probability for normal distribution : Find the Probability and inverse probability for the given Normal distribution.
Robco company case study : Robco, Inc. was a Florida arms dealer. The armed forces of Honduras contracted to purchase weapons from Robco over a six-year period.
Probability of choosing supreme chocolate : What is the probability that at least three students choose Supreme Chocolate?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Sdlcs and other sites explaining some of the tools

Visit web sites for the few leading information systems consulting the firms. Try to determine the information regarding the approach they utilize in order to develop systems. Specify whether SDLCs are described there? Also state do their sites ex..

  How to concern about personal privacy, efficiency

How to concern about personal privacy, efficiency

  Program to carrying out the arithmetic calculations

Write down a program which will help an elementary school student learn about the addition, division, subtraction, multiplication. Utilize the and function in order to generate two positive one-digit integers.

  Related to investment in stock group

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

  Exploring web for security education

Explore the Web for security education and the training programs within your area. Keep down a list and examine which of the category has most examples.

  Utilizing the dss-es-ess or intelligent systems

An American Company announced that it was interested in attaning a company in the health maintenance organization (HMO) field. Two decisions were included in this act: The decision to attain an HMO.

  Controlling congestion in error-free virtual circuit subnet.

Consider the following method for congestion control in the error-free virtual circuit subnet. A router may only transmit ACK for a received packet if it knows packet transmission along with the virtual circuit through subsequent routers is succes..

  Define the way for creating work breakdown structure

Define the way for creating work breakdown structure Use a hypothetical project to illustrate your understanding of the WBS.

  Operation for circular linked list

Write down an algorithm or code segment for searching the circular linked list for a given item. Write down an algorithm or the code segment for locating nth successor of an item within a circular linked list (nth item which follows the given item ..

  Determining the output

Specify the output if input is diamond diamond? State the output if the input is diamond gold?

  Scripts_new directory and dir.txt file

Write down the following folder structure on C: drive of your computer: Scripts_New, Networking, User.

  Create a program that displays all of numbers in the file

Create a program that displays all of numbers in the file

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