+ 1
Confused in pointers with arrays
Let there is 1-D array arr={1,2,3,4,5,6} And 2-D array A={10,11,12,13,14,15} Now the real problem.. cout<<*arr // 1 cout<<*A // address cout<<**A // 10 Can you explain why the output is like this?? In 2d array A points to the first element then writing *A should print first elememt like 1D array does..
4 Answers
0
Martin Taylor
Yeah..I gave an overview about my problem..bcoz i wanted explanation of cout statements only..so there was no need of whole code..
Anyway, thanks for explainingđ
PS:- Why did you think that both are single dimensional array??đ€ 2D array can be declared like this..
0
Martin Taylor
I already mentioned there was no need of code in this..I just wanted to know the concept of array with pointers..
and I also wrote âlet there is an 1D/2D array" (just suppose there is an array)
Anyways, Sorry if it bothered you to understand the problem..