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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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