```
void sortAllWay(int arr[][N]) 
{ 
    // Consider matrix elements (in row major 
    // order) and sort the sequence. 
    int *ptr = (int*) arr; 
    sort(ptr, ptr + N * N); 
} 

```

What exactly does this piece of code do?

We passed an array to it, and it has been sorted. I have sorted arrays like `sort(arr, arr + n)` where `n` is the size of the array. However this doesn't make much sense to me.