What is the value of using new and delete in c++

Assignment Help Basic Computer Science
Reference no: EM13308208

Answer the following questions:

     a) Explain the differences between float x; and float* ptrx;

 

    b) Show the output from the following program. If an unknown value gets printed, write U.

          int main()

          {

               int m, n;

               int* p = &m;

               int* q;

               *p = 35;

               cout << *p << ' ' << *q << endl;

               q = &n;

               n = 50;

               cout << *p << ' ' << *q << endl;

               p = &n;

               *p = 10;

              cout << *p << ' ' << n << endl;

              return 0;

          }

 

    c) Declare a pointer variable q and initialize it to point to the first element of an int array named arr. Use the pointer variable to print

        out the elements of the array arr.

 

d) Draw the memory map of the following code sequence:

              double u, x(20.5); //assume the address of y is 10

               double *a = &x; //assume the address of x is 14

               y = *a;

    e) Answer the questions given at the bottom of this code sequence:

              int x, y;

              int *p1, *p2;

              x = 6;

              p1 = &x

              y = *p1/2 + 10;

              p2 = p1;

        What is the value of x? ___

        What is the value of y? ___

        What is the value of *p1? ___

        What is the value of *p2? ___

    f) What is the value of using new and delete in C++?

Reference no: EM13308208

Questions Cloud

Shows a cdma example that supports two senders : It shows a CDMA example that supports two senders. Suppose that the receiver wanted to receive the data being sent by sender
Estimate the angular wave number : A wave has angular frequency 135 rad/s and wavelength 1.70 m. Calculate the following values of the wave. estimate the angular wave number
Compare and contrast how useful each engine : Compare and contrast how useful each engine was in terms of providing reliable information, not just manufacturer's ads. Ask and AoL.
Find vertical reactions and construct complete shear moment : A 16-ft [4.88 m] span beam is fixed at one end and simply supported at the other end. A single concentrated load of 9600 lb [42.7 kN] is placed at the center of the span.
What is the value of using new and delete in c++ : Show the output from the following program. If an unknown value gets printed, write U.
Calculate the density of a mixture of air and so2 at a temp : calculate the density of a mixture of 90% air and 10% SO2 at a temperature of 150 degrees C and pressure of 1.10 atm.
Allocate new memory and release unneeded old memory : During an exec call in Minix, it tests for an adequate hole before releasing the current process memory. Reprogram this algorithm to do better.
Determine the weight of the satellite in pounds : A satellite would have a mass of 200 kg on the surface of the moon. Determine the weight of the satellite in pounds when it is in orbit 10,000 mi. above the surface of the earth.
Draw the pipeline execution diagrams : In snippet A, the branch is taken twice and then not taken. In snipped B, first branch is taken once and second branch is also taken once.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Determine difference between repeated set of measurements

By this time you are prepared, I trust, to determine that there would be some difference between, two averages. What must we do in such a case?

  Explain computer viruses spread by email or other methods

Explain computer viruses spread via email or by other methods. What negative consequences can they have on an organization's operations?

  What is an object lock and which object have locks

What is an object's lock and which object's have locks?

  Explain delimiter marks only beginning of comment

Delimiter marks only the beginning of the comment (for one line comments). Write the advantages and disadvantages of each of these with respect to our criteria.

  Write a function in c language with prototype

write a function in C language with prototype.

  Resolve this problem within wireless technology

You can resolve this issue by wiring but you do not want to do that. What can you do to resolve this problem within wireless technology?

  Riordan manufacturing

A full description of the new system, a description of its components, and the benefit it will provide to Riordan Manufacturing (Virtual Organization)

  Write component which is part of lcd panel assembly

Write down three ways notebook can get its power? Write down component which is part of the LCD panel assembly might be responsible for LCD panel showing dim screens?

  Who swallowed a spider

There was an old woman who swallowed a fly. I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a spider,

  Design a nine-step counter to count

Design a nine-step counter to count in the following sequence using D flip-flops (TTL 74704) on a breadboard

  Write a class encapsulating the concept of a rational number

Write a class encapsulating the concept of a rational number, assuming a rational number has the following attributes: an integer representing the numerator of the rational number another integer representing the denominator of the rational number

  The techniques in discovering the requirements

What are some of the techniques in discovering the requirements (fact finding) for a system?

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