If I have an array declared like this:
int a[3][2];
stored at address A.
Then a+1 is equal to A+2*4, this is clear to me,
but why is &a+1 equal to A+6*4?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ais an array ofint[2]. Which has size2 * sizeof(int). That’s whya + 1 = A + 2*4. (sincesizeof(int) = 4in your case)However,
&ais a pointer toint[3][2]. Sincesizeof(int[3][2]) = 6 * sizeof(int), therefore:&a + 1 = A + 6*4