Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does c++ change the value of a variable at the address pointed by the pointer, that is, change a variable pointed by the pointer?
How does c++ change the value of a variable at the address pointed by the pointer, that is, change a variable pointed by the pointer?
int? x? = 10; //Define an integer variable x with an initial value of 10.

int? *p? =? & ampx; ? //? Define a pointer p, so that the pointer points to the variable X.

*p? =? 100; //Assign a value to X through the pointer P ... The key to changing the value of the variable X to 100 is

* p = 100; Statement, meaning: assign the value of the variable x pointed by p to 100.