How come my array index is faster than pointer

后端 未结 10 616
青春惊慌失措
青春惊慌失措 2020-12-17 16:58

Why the array index is faster than pointer? Isn\'t pointer supposed to be faster than array index?

** i used time.h clock_t to tested two functions, each loop 2 mil

10条回答
  •  Happy的楠姐
    2020-12-17 17:27

    The times are so close together that if you did them repeatedly, you may not see much of a difference. Both code segments compile to the exact same assembly. By definition, there is no difference.

提交回复
热议问题