In our legacy C/C++ code I encounter two versions of signatures
void foo1(double *vec, int n)
and
void foo2(double vec[], int n)
But there is no difference in the handling of the parameter vec inside of the methods e.g.:
void foo2(double vec[], int n){
for(int i=0;i<n;i++)
do_something(vec[i]);
}
Is there any difference between the first version (double *) and the second (double ..[])? In which situations should a version be preferred over the other?
Edit: After the hint of @Khaled.K I tried to compile:
void foo(double *d, int n){}
void foo(double d[], int n){}
and got a compile error due to redefinition of void foo(double *d, int n). So double *vec and double vec[] mean the same.
The still open question is which version should be used when.