edited by
299 views

2 Answers

Best answer
2 votes
2 votes
int *A[10];

[ ] has higher precedence than *, hence A is an array of 10 items which are pointers to int.

A[2][3] = *( A[2]+3) = *(*(A+2)+3)

Suppose array A contains the starting address of others 1-D arrays.

A[0]=1000

A[1]=2000

A[2]=3000

A[3]=4000

and so on...

Base address of array A is suppose 100 an pointer needs 2 bytes.

then *(A+2) means *(100+2*2) = *(104) = 3000

derefrence  it further

*( 3000 + 3) = *(3000 + 3*2) = *(3006)

conclusion, A[2][3] will give 4 th element of 3rd array.
selected by
0 votes
0 votes
Here  [] have higher precedence than *  so array of pointers to integers are created

A[2][3] refers to third array 4th element  initially A[2] will store the address it needs to point to

Related questions

0 votes
0 votes
0 answers
4
hem chandra joshi asked Nov 12, 2017
245 views
A programming language not supporting either recursion or pointer type does not need the support of dynamic memory allocation ?