change and return arrays from a function
I want to input empty arrays into a function and change the values and return those arrays. I remember something about if I only use *array1 as input, that array won't be re-written. Should it be something like:
Code:
void function(int **array1, int **array2){
int i;
for (i=0 ; i<10; i++){
array1[i]=i;
array2[i]=10-i;
}
}
int main(){
int *array1, *array2;
//allocates memory for array1 and array2 from another function then
function(&array1, &array2);
}
will that write the values into array1 and array2?
thanks in advance