I originally thought that the key advantage to passing a pointer to an array to a function was to prevent copying of the entire array. However the answer to , this question points out that even if the function's parameter is int []
it decays into a pointer. I wrote sample code and verified this myself.
I have done googling and reading and mostly what I see is that historically there was some advantage to using pointers which avoided extra arithmetic calculations array indexing requires. But the articles also said that today this is no longer an issue because compilers and chip makers have made aggressive optimizations and array indexing is just as fast.
If this is true, is there any practical advantage to passing the pointer explicitly?
I don't know if this question will elicit opinion based responses. If so, it is not my intention. I am hoping for a response that makes a clear case for explicitly passing pointers. Thanks.
Edit Links to articles I read: