What will be the address of the arr[2][3] if arr is 2d?
Answers
Answered by
0
Answer:
you can't tell the exact address as it may vary depending on how the memory has been allocated to it but in general, take reference the starting position i.e. arr[0][0] and keeps adding the size of int.
Explanation:
#include <stdio.h>
int main()
{
int arr[3][3];
for(int i=0;i<3;i++){
for(int j=0;j<3;j++)
printf("%d %d %d\n",&arr[i][j],i,j);
}
return 0;
}
returns
1732977680 0 0
1732977684 0 1
1732977688 0 2
1732977692 1 0
1732977696 1 1
1732977700 1 2
1732977704 2 0
1732977708 2 1
1732977712 2 2
every address is incremented by 4 in this case.
Similar questions