What is the output of the following code

Assignment Help C/C++ Programming
Reference no: EM13340062

1. What is the output of the following code?
int *p;
int *q;
p = new int;
q = p;
*p = 46;
*q = 39;
cout << *p << " " << *q << endl;

2. What is the output of the following code?
int *p;
int *q;
p = new int;
*p = 43;
q = p;
*q = 52;
p = new int;
*p = 78;
q = new int;
*q = *p;
cout << *p << " " << *q << endl;

Reference no: EM13340062

Questions Cloud

What is the x-component of the electric force exerted by a : Particle A of charge 5.00x10-4 C is at the origin, particle B of charge -5.00x10-4 C is at (3.00 m, 0) and particle C of charge 3.00x10-4 C is at (0, 2.00 m).
One current economic issue facing the american government : One current economic issue facing the American government is ensuring people in danger of foreclosing on their homes can keep them. Explain why this issue is important
How many kilograms of water are poured onto a fire : Three fire hoses are connected to a fire hydrant. Each hose has a radius of 0.013 m. Water enters the hydrant through an underground pipe of radius 0.094 m. In this pipe the water has a speed of 3.2 m/s.
Review current standards across all similar job title : There are many elements and measures for workforce effectiveness. One measure of effectiveness is that all employees within a specific job title, such as program assistant, are held to the same standards.
What is the output of the following code : What is the output of the following code?
What is electric field at a point midway between two charges : Two point charges are separated by 10.0 cm and have charges of +2.00 and -2.00 Coulombs. What is the electric field at a point midway between the two charges
What difference of temperature is needed to have volume : Rivets can be cooled before they are put in place, thus when they reach equilibrium temperature they are more firmly fixed in place. If the volume expansion of iron is 35.0 X 10-6 K-1
Explain how the nominal dollar/euro exchange rate would be : Explain how the nominal dollar/euro exchange rate would be affected (all else equal) by permanent changes in the expected rate of real depreciation of the dollar against the euro.
The legal and ethical considerations of marketing in america : The Legal and Ethical Considerations of Marketing in America Paper

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Program that can serve as a simple calculator

Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by..

  Output the even numbers from 1 to 10 in ascending order

Output the even numbers from 1 to 10 in ascending order, then the odd numbers from 10 to 1 in descending order: 2 4 6 8 10 9 7 5 3 1. in C++

  Write function that randomly produces maze

Write a function mazeGenerator that randomly produces a maze (in C++). The Function should take as arguments a two-dimensional 12-by-12 character array.

  Program that asks the user to enter the number of miles

Write a C - program that asks the user to enter the number of miles traveled and the number of gallons of gasoline consumed. It should then calculate and display the miles-per-gallon value. Confine your output to 1 decimal place.

  Write a program in which the user is prompted

Write a program in which the user is prompted for the number of values that they will be entering. The user then enters that number of integers into an array

  Create a file, shared.txt

When your program starts, it shall do the following:1. Create a file, SHARED.txt, in the current directory (cwd). 2. Write it's pid (Process ID) followed by a Carriage Return and Newline in the file.

  A c++ program using the concept of function overloading

write a c++ program using the concept of function overloading for the following options : select the options from [1-3], 1- Area of rectangle 2- Area of square 3- Exit ,

  Express the definition of the class rectangletype

The definition of the class rectangleType and the definitions of the operator functions are.

  Write program that stores the numbers in array

Write a c++ program that stores the following numbers in the array named miles: 15,22,16,18,27,23, and 20. have your program copy the data stored in miles to another array.

  Write a program to analyze students course marks

Write a program to analyze students course marks. The program should read in students course marks from "m2-grading.txt". The data file has a headline including students ID#, course-1marks, course-2 marks and course-3 markes.

  Write a recursive definition in sml to reverse

Write a recursive definition in SML to reverse a list of elements and multiply all elements with 2.

  Structs in an array of employee data.

Below is the instructions of my C++ Lab. The program must build in Microsoft Visual C++. Please use headers so the program will compile

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