Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在 gdb 中调试它们时,它们似乎有所不同。
(gdb) p order[1] $16 = (struct order_s *) 0x746440 (gdb) p *order+1 $17 = (struct order_s *) 0x746430 (gdb) p *order $18 = (struct order_s *) 0x746420
C中的*a[1]和*(*a+1)有什么区别?
操作顺序。a[1]是一样的*(a+1)。所以,*a[1]是一样的*(*(a+1))。如果你有,*(*a+1)那么你实际上是在做*(a[0]+1).
a[1]
*(a+1)
*a[1]
*(*(a+1))
*(*a+1)
*(a[0]+1)