I would like to know - is there any way to copy array to a function in C/C++? Not pass it just an address, but create a copy... Like for int value. For example here we send not a copy(((:
void arrayAbs(int array[], int size) {
for ( int i = 0; i < size; i++ ) {
if ( array[i] < 0 ) {
array[i] *= -1;
}
}
}
std::array<T>(see reference), orstd::vector<T>std::vectoror (better)std::array(C++11 only)