Question: C++ Memory Allocation: 1) Write a C++ program that allocates static, stack, & heap memory. Your program does not need to do anything else.Indicate via

C++ Memory Allocation:

1)Write a C++ program that allocates static, stack, & heap memory. Your program does not need to do anything else.Indicate via commentswhere memory for at least one variable in each memory area is allocated.

a) Write code that allocates static memory (only include one declaration):

b) Writecode that allocates stack memory (only include one declaration):

c) Writecode that allocates heap memory (only include one declaration):

2)

1. Edit the C++ program below to include a pointer and a reference to num. Print the number using both the pointer and the reference.

#include

using namespace std;

int main()

{

int num = 10;

cout

return 0;

}

a) Writecode that declares a pointer to num:

b) Writecode that declares a reference to num:

------------------------------------------------------------------------------------------------------------------------------------------------------------------

Please show the code and explain in comments! Show the output as well thank you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!