ARRAYS: LESSON Element Access in Multidimensional Arrays

During my task two Loop through matrix and add up all the elements. Assign your answer to the sum variable., my code

for (int i = 0; i < row;i++){ for (int j = 0; j < col;j++){ int num = matrix[i][j]; sum += num; } }

is not accepted, what is the difference between my code and official solution ?

for (int i = 0; i < row;i++){ for (int j = 0; j < col;j++){ sum += matrix[i][j]; } }