Hi, I'm writing a small project and since I'm new to pointers I've been having troubles passing an array to a function by reference.
Say:
1 2 3 4 5
int Array_data[2]={1,2};
//and I need to pass the array above to a function "solution"
solution(&array_data);
// isn't working, say the function receives it this way
// solution( int *new_array[])
What I'm doing is this:
Instead of copying the whole array from function_1 to function_2, all I wanna do is pass the address of the array in function_1 to function_2, so that I'd be able to access and change(where needed) the content of that array in function_1 in function_2.
@Matri X I never knew C++ does not allow an array to be passed as argument(s) to a function, it only allows you to pass a pointer to the array to the function(http://www.tutorialspoint.com/cplusplus/cpp_passing_arrays_to_functions.htm)
It looks like you are not an adequate. I showed you how an array can be passed by reference.