Program to find sum of diagonals in a 2D matrix using pointers