Is there a difference between:
void draw_line(float p0[2], float p1[2], float color[4]);
and this:
void draw_line(float *p0, float *p1, float *color);
in C?
There is no difference between the function declarations neither in C nor in C++.
A function parameter having an array type is implicitly adjusted by the compiler to pointer to the array element type.
From the C Standard (6.7.6.3 Function declarators (including prototypes))
7 A declaration of a parameter as ‘‘array of type’’ shall be adjusted to ‘‘qualified pointer to type’’, where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation...
Thus these declarations
void draw_line(float p0[2], float p1[2], float color[4]);
void draw_line(float *p0, float *p1, float *color);
declare the same one function and the both can be present in a program though the compiler can issue a message that there are redundant declarations.
The difference between C and C++ is that in C you can specify in brackets qualifiers and an expression with the keyword static that specifies the number of elements the arguments shall provide the access to.
- ...If the keyword static also appears within the [ and ] of the array type derivation, then for each call to the function, the value of the corresponding actual argument shall provide access to the first element of an array with at least as many elements as specified by the size expression.
In the both C and C++ an array used as an argument of such a parameter is also implicitly converted to pointer to its first element.