C   Programming: From Problem Analysis to Program Design
C Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9780357238547
Author: D. S. Malik
Publisher: Cengage Limited
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 12, Problem 15SA

Explanation of Solution

The problem with the program has been explained in the in-lined comments:

#include <iostream> 

using namespace std; 

int main()  

{  

    //pointer variables declared and memory allocated

    double *firstPtr = new double; //Line 1

    double *nextPtr = new double; //Line 2

    //value assigned to pointer variable

    *firstPtr = 62; //Line 3

    //nextPtr is assigned the pointer firstPtr

    //so nextPtr points to a memory location

    //having a stored value of 62

    nextPtr = firstPtr; //Line 4

    //memory pointed to by both the pointers are

    //deallocated

    delete firstPtr; //Line 5

    delete nextPtr; //Line 6

    //fresh memory i...

Blurred answer
Students have asked these similar questions
Generate a random sample of standard lognormal data (rlnorm()) for sample size n = 100. Construct histogram estimates of density for this sample using Sturges’ Rule, Scott’s Normal Reference Rule, and the FD Rule.
Can I get help with this case please, thank you
I need help to solve the following, thank you
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage