Diagnol traversal

I’m not able to understand the algorithim.Can you explain me in easy words and I’m not familiar with vectors so can you please convert the code in array.

using vector will make the coding easy
because in vector we can use many inbuilt function
if you didn’t learn vector now , skip this question for now

after learning vectors you can also come back to this question

important point : every diagonal can be represented by the sum of ith and jth index
try this on any matrix

Approach
traversal the complete matrix
and find out sum = i+j;
store the element arr[i][j] corresponding to sum in a vector

Reference Code

but if you need array version
then it is here
Array Version