I use this code:
memcpy(arr[i], arr1[i], sizeof(arr1[i]));
with definition:
double** arr; // arr1 is difined the same way.
arr = new double*[row];
for (int i = 0; i < row; ++i) {
arr[i] = new double[col];
memcpy(arr[i], arr1[i], sizeof(arr1[i]));
}
I built it with command : g++ -Wall -Wextra -Wpedantic -c arr.cpp
and had result:
warning: argument to 'sizeof' in 'void* memcpy(void*, const void*, size_t)' call is the same pointer type 'double*' as the destination; expected 'double' or an explicit length [-Wsizeof-pointer-memaccess]
memcpy(arr[i], arr1[i], sizeof(arr1[i]));
^
I don't understand what it is. Could you tell me how to make it work correctly?