Confused in pointers with arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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..

27th Aug 2019, 3:14 PM
Alaska
Alaska - avatar
2 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..
27th Aug 2019, 5:08 PM
Alaska
Alaska - avatar
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..
28th Aug 2019, 3:09 AM
Alaska
Alaska - avatar