How does this code work?

int i, sum=0; i = 0; while(i<3) {
sum += * ( * (arr+i)+(i++)); }
printf(“sum:%d”, sum);

“a” points to the first row. If you add 1 to “a” then we get the pointer to second row of the matrix.-- (a + 1) This is a pointer to the second row

  • ( * (a + 1) This is a pointer to the elements of the second row and points to the first element of 2nd row
  • (*(a + 1) + 5) This is a pointer to the 6th element in the second row
  • *( *(a + 1) + 5) This is the 6th element in the second row.

Now you can try on your own.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.