You're still using sizeof wrong. a in your function array is not an array. It is a pointer. The a in main and the a in array are not the same variable and do not have the same type despite sharing the same name.
You cannot determine the length of a in array. You must pass the length in as Duoas has already suggested.
I'm not sure if I can help.
You're trying to find the gcd of 4 numbers right?
I'm not sure how you would implment it but this for loop will find the gcd for 4 integers.
1 2 3 4 5 6 7 8
for( int i = num1; i > 0; i--)
{
if (num1 % i == 0 && num2 % i == 0 && num3 == 0 && num4 ==0)
{
gcd = i;
break;
}
}
@Momothegreat
OP is not trying to find the GCD of four numbers. Read his problem statement again.
@GSISONYA
I don't understand why you are spending so much time mucking around with sizeof. My advice remains the same: get rid of it. It is distracting you from your actual problem.
If you must, C++ provides a number of ways too query the compiler for an array's size, the simplest/easiest of which is probably:
array(a,end(a)-begin(a))
No matter what you do, though, you must in some way pass the length of your array as argument to the function.