Array in function prototype

When writing function prototypes that just contain ints, etc, as parameters, I usually just omit the name of the variable, like:

void oneFunc(int, int);

instead of:

void oneFunc(int var1, int var2);

Am I right in saying if one of the parameters is an entire array then I MUST use a name in the prototype/declaration?

Thanks
No
Well I did try to omit the name, but I got "invalid conversion from int* to int" errors at compilation time
The array [size] is part of the type

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void f ( int [10] );
void g ( int [] );
void h ( int * );

int main()
{
    int x[10];
    f(x);
    g(x);
    h(x);
}

void f ( int a[10] )
{
}

void g ( int a[] )
{
}

void h ( int *p )
{
}
Sorry, I don't understand
Square brackets are not the array or anything else countable. It is just a text symbol representing whatever is typed to its left until the variable declaration.

hope it'll assist.
Topic archived. No new replies allowed.