Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Pointers and Dynamic Variables 1. Consider the following fragment of code and answer the questions that follow: double temp = 98.6; double *d1 = &temp;
Pointers and Dynamic Variables 1. Consider the following fragment of code and answer the questions that follow: double temp = 98.6; double *d1 = &temp; *d1 = 29.9; (A) What is the difference between the variables temp and d1? (B) For each line of code, write the value of temp after the line of code is executed. (C) For lines 2 and 3, write the value (if known) or describe the value (if not known) of d1 after the line of code is executed. 2. Consider the following statement and answer the questions that follow: TYPE p1 = new int; (A) Describe what happens when we use the new operator. (B) What is the TYPE of the variable p1? (C) Write a statement that will destroy the dynamic variable that p1 points to. 3. Consider the following fragment of code and answer the questions that follow: int *a = new int; int *b = nullptr; *a = 2; b = a; cout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started