I am accessing array elements very frequently and want to optimise peformance as much as possible.
I would like to know exactly what the computer does with the syntax myarray[i] and how this compares to *(myarray+i). I know the answer is the same, but what about the process?
Also, what about passing arrays to functions? Ie. what is the difference between the following in terms of performance (all other things being equal):
void myfun(int myarray [])
void myfun(int myarray [N]) //N is the correct number of elements the array will contain
void myfun(int * myarray)
I would test this myself but I don't know how to implement a "stopwatch" in c++...
So is there any real reason why one would specify the length of an input array in the function in put, ie. use void myfun(int myarray [N]) instead of void myfun(int myarray), or is it just used to improve readability for the coder?