1. int *a; 2. a=new int[2]; 3. cin>>a[0]; 4. cout<<a<<"\n"; 5. cout<<&a<<"\n"; 6. cout<<*a;
what output of 5th line? know 4th line give address of first element of array , 6th line give value of first element of array a. cannot figure out address given 5th line.
thanks.
edit: output after compiling.
- 4
- 0x5d2158
- 0x28fefc
- 4
4 taken input. 0x5d2158 output of 4th line 0x28fefc output of 5th line 4 output of 6th line
it give address of pointer a
itself. pointers take space in memory store address of actual data pointing to, in case integer array.
Comments
Post a Comment