Can a pointer ever point to itself?

前端 未结 8 907
情深已故
情深已故 2020-12-04 15:29

My question is: If a pointer variable has the same address as its value, is it really pointing to itself?

For example - in the following piece of c

8条回答
  •  心在旅途
    2020-12-04 16:16

    Yes, it is possible to point to itself.

    int* a;
    a = &a;
    

    But not have any use, at least explicitly like this.

提交回复
热议问题