Need these questions answered The questions that follow are based on the followi
ID: 3869793 • Letter: N
Question
Need these questions answered The questions that follow are based on the following C++ code: /*Program to demonstrate memory allocation Written by Ron September 2017 Language: C++ (Cygwin 64 bit g++ compiler) variable names are taken from characters on the sit com Bewitched that ran from 1964-1972 #include using namespace std: int main(void) i int darrin, samantha, tabitha: int 'endora, 'gladys_kravitz, abner_kravitz, aunt_clara; darrin-23 samantha#7; tabitha-darrinSsamantha; endora-&darrin; gladys_kravitz-&samantha; abner kravitz=&tabitha; aunt clara-new int aunt_clara-(*endora)+(abner_kravitz): cout
Explanation / Answer
1.
2.
This is because the aunt_clara is dynamically allocated memory with new
aunt_clara = new int;
The value pointed to by aunt_clara is
*aunt_clara = *endora + *abner_kravitz;
*endora = 23
*abner_kravitz = 2
23+ 2 = 25
c.
Output:
Address Variable stored here Value cbfc darrin 23 cbf8 samantha 7 cbf4 tabitha 2 cbe8 endora cbfc cbe0 gladys_kravitz cbf8 cbd8 abner_kravitz cbf4 cbd0 aunt_clara 10440 10440 None 25Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.