How to scan elements and access 2D array by the help of pointer . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to scan elements and access 2D array by the help of pointer .

like in 1D array we .. int A[10],*p,i; p=A; for(i=0;i<10;i++) scantf("%d",(p+i)); for(i=0;i<10;i++) printf("%d ",*(p+i)); like this method plzzz...answer for 2D array and please answer same question when we make array dynamically

19th Aug 2017, 9:27 AM
CHandan AGrawal
CHandan AGrawal - avatar
1 Answer
0
2d array is same as 1d array for machine. So int a[4] same as int b[2][2]. So it goes like b[0][0]b[0][1]b[1][0]b[1][1] in memory.
28th Apr 2019, 5:42 AM
Dima Sl
Dima Sl - avatar