need to return an array, which is not possible in C/C++ code example
Example: cpp return array
int * fillarr(int arr[], int length){
for (int i = 0; i < length; ++i){
// arr[i] = ? // do what you want to do here
}
return arr;
}
// then where you want to use it.
int main(){
int arr[5];
int *arr2;
arr2 = fillarr(arr, 5);
}
// at this point, arr & arr2 are basically the same, just slightly
// different types. You can cast arr to a (char*) and it'll be the same.