[I tried two ways, one is with line 14 and the other is with line 15.Why does line 14 pass the compiler but line 15 does not?]
I did it in two separate steps, the first with a 14-line method alone, and the second with a 15-line approach.
#include<stdio.h>
int main() {
int matrix[][4] =
{{14, 10, 6, 4}, {3, 7, 18, 11}, {13, 9, 5, 17}, {19, 12, 2, 1}};
// Checkpoint 1 code goes here.
int rowDimension=sizeof(matrix)/sizeof(matrix[0]);
int columDimension=sizeof(matrix[0])/sizeof(int);
// Checkpoint 2 code goes here.
for(int i=0;i<rowDimension;i++){
for(int j=0;j<columDimension;j++){
int sum = sum+matrix[i][j]; //line 14
int sum +=matrix[i][j]; //line 15
printf("%d\n",sum);
}
}
}