Difference between int * array and int array[] in a function parameter Difference between int * array and int array[] in a function parameter arrays arrays

Difference between int * array and int array[] in a function parameter


There is no difference. Both functions types (after adjustment) are "function taking a pointer to int and an int, returning void." This is just a syntactic quirk of C++: the outermost [] in a function parameter of non-reference type is synonymous with *.


Different ways to express the same thing.You are simply passing an array to functions by pointer.


when you pass an array to functions it implicitly passes it by pointer. because if there is many elements in array pass by value copying it is a Huge overhead. even-though it looks different its same.

you can't use both functions at same time. if you do its compile time error

 error: redefinition of 'void myFunction(int*, int)' it is already defined.