This question has already been answered:
I wanted to sort the matrix, working with it as with a one-dimensional array, that is, moving directly through memory. If you make a static array int a[2][2] , then on request std::cout << *(*a+3); I get the same a[1][1] that I need. But as soon as I made a dynamic array
int** b = new int*[2]; for(int i = 0; i < 2; i++) { b[i] = new int[2]; } then with the same call std::cout << *(*b+3); and for any value, outside the 1st row (for a given matrix, with 1 and 2 outputs the value, and with 3 and 4 outputs 0) it displays 0. Rummaged in this (if I'm not mistaken, then std::cout << *(b + i); should output the address of the 0th element of the i-th line) it turned out that if you create an array on the n-th number of lines and
from 1 to 6 elements - 32 bytes are allocated to each line
from 7 to 10 elements - 48 bytes per line
from 11 to 14 - 64 bytes each
from 15 to 18 - 80 bytes
and so on
Please explain how it works.