Does pointer arithmetic have uses outside of arrays?

后端 未结 7 1988
青春惊慌失措
青春惊慌失措 2020-12-17 15:00

I think I understand the semantics of pointer arithmetic fairly well, but I only ever see examples when dealing with arrays. Does it have any other uses that can\'t be achie

7条回答
  •  北海茫月
    2020-12-17 15:27

    From the top of my head I know it's used in XOR linked-lists (very nifty) and I've seen it used in very hacky recursions.

    On the other hand, it's very hard to find uses since according to the standard pointer arithmic is only defined if within the bounds of an array.

提交回复
热议问题