Using original pointer after realloc?

后端 未结 2 1693
后悔当初
后悔当初 2021-01-17 14:45

I was reading Richard Reese\'s new (May 2013) O\'Reilly book \"Understanding and Using C Pointers\", and I have a question about some code therein, on page 87.



        
2条回答
  •  [愿得一人]
    2021-01-17 15:29

    It is safe to use the dangling pointer (e.g. for "pointer arithmetic") as long as you don't try to dereference the pointer (i.e. apply the operator *).

提交回复
热议问题