Home > Back-end >  C language pointer is a pointer to the variable address this sentence right?
C language pointer is a pointer to the variable address this sentence right?

Time:09-19

, how do you do, in fact the title of this sentence I know is right, but I now suddenly by blocking is thinking at the time of writing the program below I found if I direct output to pointer of the output value is not a pointer to the variable's address, I don't know why, bother you give me solution, appreciate
 # include 
Int main ()
{
int a;
Int * pa=& amp; a;
Printf (" please enter a number \ n ");
The scanf (" % d ", pa);
Printf (" the name of the pointer address: % p \ n ", & amp; Pa);
Printf (" the name of the pointer value: % lx \ n ", & amp; Pa);
Printf (" pointer address: % p \ n ", * pa);
Printf (" the value of the pointer: % d \ n ", * pa);
Printf (" variable address: % p \ n ", a);
Printf (" the value of a variable: % d ", a);
return 0;
}

CodePudding user response:

& Is pick up address, * is taking the address in the value of the
Pa is a pointer, so & amp; Pa is the secondary pointer, rather than the pa,

CodePudding user response:

reference 1/f, the truth is more important than right or wrong response:
& amp; Is pick up address, * is taking the address in the value of the
Pa is a pointer, so & amp; Pa is the secondary pointer, rather than the pa,
value and address, I know, but I put & amp; Pa pa output instead of the result is the same, I was puzzled by the by,

CodePudding user response:

 int a; 
Int * pa=& amp; a;
Printf (" please enter a number \ n ");
The scanf (" % d ", pa);
Printf (" the name of the pointer address: % p \ n ", pa).
Printf (" the name of the pointer value: % lx \ n ", * pa);
Printf (" pointer address: % p \ n ", pa).
Printf (" the value of the pointer: % d \ n ", * pa);
Printf (" variable address: % p \ n ", & amp; A);
Printf (" the value of a variable: % d ", a);
return 0;

CodePudding user response:

 
#include
Int main ()
{
int a;
Int * pa=& amp; a;
Printf (" please enter a number \ n ");
The scanf (" % d ", pa);
Printf (" the name of the pointer address: % p \ n ", & amp; Pa);
Printf (" the name of the pointer value: % lx \ n ", pa).
Printf (" pointer address: % p \ n ", & amp; Pa);
Printf (" the value of the pointer: % d \ n ", pa).
Printf (" pointer to the value of a variable: % d \ n ", * pa);
Printf (" variable address: % p \ n ", & amp; A);
Printf (" the value of a variable: % d ", a);
return 0;
}
  • Related