int r, c;
cin >> r >> c;
is a variable-length array declaration.
This array has a storage duration that is set automatically.
And when the values of the variables r and c are known, the array is created at run-time.
Variable length arrays, on the other hand, are not a standard C++ feature.
You could use the standard container std::vector instead of the array.
All elements of the matrix will be zero-initialized if you use std::vector> matrix(r, std::vector(c)).