Which is faster accessible array of N number or N no of variables of same type as of array in a loop ?

Time dependency of variables usage.

10/10/2019 5:53:02 PM

Shivam Modi

4 Answers

New Answer


According to you which should be faster and why?


Shivam Modi Yes you are right. It general it should be faster to access N numbers in single array than to access them as N variables as each of those N variables needs to loaded in memory before reading where as in case of array its a matter of incrementing the index and dereferencing the pointer internally.


N no of Array means multiple Array and array of N number means single array. So think which will be faster.


I think array of N number is faster to access than the N seperate variables. Because of the continuous memory allocation . Correct me if I am wrong.