Home > Back-end >  Often pointer and a pointer to constant
Often pointer and a pointer to constant

Time:11-05

* a const pointer constant stress you can not to this pointer quadratic assignment,
Const * pointer often stressed you may not use the pointer to the content of the operating point to,

CodePudding user response:

Simple piece of

* and the location of the const can read the right name

Int * int pointer [i.e. is the content of the pointer to int]

Pointer const * constants [i.e. constant] is the content of the pointer to

Const int * int const pointer [i.e. type int is the content of the pointer to a constant]


Distinguish between the two to learn the language well

CodePudding user response:

Pointer to a constant said store in the pointer is the address of a constant, constant pointer refers to the pointer itself is constant, not modify the pointer saved in the address, the address stored can is a constant variables,
Please refer to the concrete difference between "pointer to a constant and a constant pointer in c + +"
Wish I could help you!

CodePudding user response:

Is pretty funny, most of the C language books don't put the question clear,

CodePudding user response:

 const * pointer often stressed you may not use the pointer to the content of the operating point to 

This sentence need to change, may not use this pointer to modify (write) point to content, not including reading oh, can be read

CodePudding user response:

Everyone a great god, fine product, what is refined,

CodePudding user response:

reference 5 floor Wyk2016 reply:
everyone a great god, fine product, what is a refined,

4th floor brother proposal is very good,

CodePudding user response:

reference response: 1/f, qian dream life
simple piece of

* and the location of the const can read the right name

Int * int pointer [i.e. is the content of the pointer to int]

Pointer const * constants [i.e. constant] is the content of the pointer to

Const int * int const pointer [i.e. type int is the content of the pointer to a constant]


It is ok to distinguish between the two to learn the language well

Don't have their own ideas, too rigid, no essence,