In the piece of code, arr[ ][ ] is a 2D
array and assume that the
contents of the 2D
array are already filled up. What is stored in the
variable sum at the end of the code segment?
int arr[3][3];
int i, sum=0; i = 0; while(i<3) {
sum += * ( * (arr+i)+(i++)); }
printf(“sum:%d”, sum);
A) Sum of all elements in the matrix
B) Sum of alternate elements in the matrix
C) Sum of the elements along the principal diagonal
D) None
my answer is option D.
but answer given was option C.
suggest me the answer and why