C Program to interchange the main diagonal elements of the matrix

Every square matrix has two diagonals: the main diagonal (top-left to bottom-right, elements a[i][i]) and the anti-diagonal (top-right to bottom-left, elements a[i][n-1-i]). This program reads a square matrix, swaps each main-diagonal element with the anti-diagonal element in the same row, and prints the result. The original post used void main(), a broken scanf format string …