The type int *a[2] means an array of 2 pointers to int , but the expression &a with the definition int a[2] means a pointer to an array of 2 int . Both are different types and there is no conversion between them. As Vlad already said, to ensure the correct type you need to add brackets:
void setvalues( int (*c)[2] )
Or you can use the actual links in C ++:
void setvalues( int (&c)[2] )
In a later case, you do not need to use the address of the operator or setvalue it inside the setvalue function:
int a[2]; setvalues(a);
An easier way to write code is to use typedef :
typedef int twoints[2]; void setvalue( toints& c ); int main() { twoints a;
David RodrΓguez - dribeas
source share