Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Can you directly assign a value to the data pointed by the pointer in C language? why
Can you directly assign a value to the data pointed by the pointer in C language? why
You can assign values directly to the data pointed by the pointer.

Because the *p operation is such an operation, the value of p is returned as the value of the address space. Variables that store addresses are called pointer variables. Pointer variable is a special variable, which is different from the general variable. General variables store the data itself, while pointer variables store the address of the data.

When using a pointer, the program can directly use the memory address stored in this pointer and the function value stored in this address.

Extended data:

There are two places to pay attention to:

1, * When the program declares a variable, it just means "It is an unsigned integer, pointing to a memory address, and accessing sizeof(type) at one time". This should not be confused with the (*) operator;

2. When the C++ program declares the variable &; Just say "it is a reference, and this reference did not open up new space when it was declared." It adds a new row to the memory allocation table, and the memory address of this row is equal to the memory address of the corresponding parameter passed in when it is called. "

Do not use it with the (*) declarator, (&; ) operator confusion.

References:

Baidu Encyclopedia-Pointer Variable

Baidu encyclopedia-pointer