I have forgotten how to pass an array to a function! I need to send an array to a function to perform a test on it's contents. Any help would be much appreciated!
I have forgotten how to pass an array to a function! I need to send an array to a function to perform a test on it's contents. Any help would be much appreciated!
You should pass it by reference
Returntype FunctionName( ArrayElementtype* Name );
Example
int Array[4];
void Search( int* Blah ); // you can also use []
or, if you know that it has to be of a certain length, then do
void Search( int (&Blah)[4] );
You'd call either by just doing
Search( Array );
In the function's body, you'd access the array with the same syntax as if you were directly working with the array.
you need to pass the array by reference using something like this
function_name(&array_name[])
im pretty sure this is right
C++ can hurt.
Thanks a lot!