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

  Sha-256 and rc4

SHA-256 (with 256-bit output) is more resistant to the attacks based on birthday paradox than SHA-1. Key reuse is deadly for the stream ciphers such as RC4.

  Determining the asymptotic formula

Provide an asymptotic formula for each of the following recurrence equations, utilizing big “Θ” rather than just big “O” for better results whenever possible.

  What is the specialization of Dottie's Tax facility

What is the specialization of Dottie's Tax facility At least 6 returns? (Round z-score computation to 2 decimal places and your final answer to 4 decimal places.)

  Information security

What skills are required by personnel working in the information security? State some job titles in field and come up with some required qualifications and some desirable qualifications.

  Program to print the chain of numbers

Write down the program that prints out the chains for numbers within the range which the user specifies. The length of each chain must be printed at the end of the chain.

  Designing an inventory management system

Xhemrock is a brake pad manufacturing company. This company utilizes the raw materials, like carbon powder, ash, iron, and resin. It wishes to design an inventory management system which will have the following attributes: The system must store th..

  Problems on relation and functional dependencies

Problems on  relation and functional dependencies

  What factors in computer design would affect the decision

What factors in computer design would affect the decision.

  What occurs in an infinite loop

What occurs in an infinite loop? Create your own Repeat-until repetition arrangement.

  What is dft of a pure cosine wave cos

What is DFT of a pure cosine wave cos(t) sampled at n equally spaced points on the interval [0, 2π)?

  Developing the function to list software installed on system

Write down a function which list the software (name and vendor) installed over the computer specified by the input argument. The function should output the list to screen and output the list to the CSV file.

  Generate an er model

Generate an ER model

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