To assign the variable LastIndex to the last element of the array,arr_merge[SizeArray] is enough. Subtracting one from the subscript gives the second to last element.
To find the middle of an array you need parenthesis.
((BeginIndex+LastIndex)/2)
Not sure why thats a parameter when it can just be assigned to mid though.
Arrays are implicitly passed as pointers automatically...I think that's what you were trying to know....
In reality void FunctionA(int arr_merge[]) is void FunctionA(int * arr_merge). So inside the function you have no information about the size of the array, so SizeArray is being calculated as the size of a pointer divided by the size of an int (I would expect that to be one but anyway).
// either pass in the size...
void FunctionA(int arr_merge[], int N)
{
int SizeArray = N;
cout << SizeArray << endl;
}
//or pass the array by reference, and use templates
template <typename T, int N>
void FunctionB(T (&arr_merge) [N])
{
int SizeArray = N;
cout << SizeArray << endl;
}
int main()
{
int arrayNumber[] = {1,2,3,4,5,6,7,8,9};
// pass in the size
int size = (sizeof(arrayNumber)/sizeof(arrayNumber[0]));
FunctionA(arrayNumber, size);
// pass the array by reference...
FunctionB(arrayNumber);
return 0;
}