(Please send me the answers TYPED, not in a picture) THANK YOU. 1.) The boxes be
ID: 3697595 • Letter: #
Question
(Please send me the answers TYPED, not in a picture) THANK YOU.
1.) The boxes below represent the declared variables of the C++ code. To the left of the box is the memory address, below is the associated variable name, and inside the box are the memory contents. For the questions below, fill in the final contents of the variable inside the boxes. 0x00 0x04 0x08 double x, y; double *z; x = 15.14; 0x00 0x04 0x08 intx int *y, *z; x = 10 0x00 0x01 0x02 0x03 0x04 0x05 int x[4]- 15, 8,11, 13 int y, *z;Explanation / Answer
1.
a) x=15,14
y=15.14
*z=15.14 (this is value at the z) because z contains the address of z.
b) x=15.
*y=15.
*z=15. (because z contains the address of x and z is assigned to y).
c) x[0]=5;
x[1]=8
x[2]=11
x[3]=13
y=6
*z=5(base address of array is x and its value is 5)
2.
dynamic array creation and intialization
int *a=NULL;
a[0]=100;
cout<<"value of first array element is "<<a[0];
by using the index position value we can add one more element to the array
cout<<"enter a value";
cin>>a[1];
and we print these values to the console.
deleting the memory for this dynamic array can be done as follows
delete [] a;
a=NULL;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.