How to understand static void * a = & a;?

how to understand this line of code?

 static void * a = &a;
 

I saw it on the source code of AFN.

static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerObserverContext;
The

AFURLRequestSerialization.h file is used when serializing.
this style of code has been seen several times elsewhere.

Zhihu has the same problem ,

the answer is
this is a static untyped pointer an and then assigning it to a with a pointer drop address is an initialization. That is, a pointer pointing to a pointer.

I don"t quite understand. I don"t think the explanation is very clear for several answers.

I"ll ask again here.


two steps
first declare

static void * a

an is a pointer to an address, which itself has an address

then

*a = &a

point the address pointed to by a to the address pointed to by a pointer


static void * a = &a;

take it apart and see:

  • & an is a pointer to a and is a memory address
  • void * is an untyped pointer. Static has no effect on interpretation. The pointer points to the memory address of a
  • .

to sum up, it is the pointer to the pointer (& a) (void *)


this is a way to initialize untyped (void) pointers by assigning the pointer's address to the pointer itself, for example.

What is the purpose of this definition of
  

?

Menu