Home > Software engineering >  C for variable address pointer
C for variable address pointer

Time:10-08

Existing variable int a; Step how to get to the address of a pointer, such as int * * b=& amp; & a; (not the usage)
Multi-step can realize: int * p1=& amp; a; Int * * p2=& amp; P1. Why int * * b=& amp; & a; Is not,

CodePudding user response:

& The address-of operator, operands need is an lvalue ~

CodePudding user response:

Pointer to the address of a "
First of all, you need to have a "point to the address of a variable, here you only have a this variable, and not" of "pointing to the address of a variable, you how to get the address of the variable?
Int * p1=& amp; a; Int * * p2=& amp; P1.
Such, first of all, p1 is a variable, somewhere in the memory, storage is the address of a value, this time can get the address of the p1, placed in p2,

CodePudding user response:

& A is the right value, no address, so can't take the address again,
When you put this & amp; Assign a value to a variable b, address is again & amp; B, not & amp; & A,

CodePudding user response:

& & Is logical and
Int a=0;
Int * pa=& amp; a;//pointer
Ppa int * *=& amp; Pa;//pointer to pointer

CodePudding user response:

If the int * * b=& amp; & a; Can work then int * b=& amp; 1; Also should be able to work
  • Related