Efficiency: arrays vs pointers
问题 Memory access through pointers is said to be more efficient than memory access through an array. I am learning C and the above is stated in K&R. Specifically they say Any operation that can be achieved by array subscripting can also be done with pointers. The pointer version will in general be faster I dis-assembled the following code using visual C++.(Mine is a 686 processor. I have disabled all optimizations.) int a[10], *p = a, temp; void foo() { temp = a[0]; temp = *p; } To my surprise I