Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Pointer variable assignment method
Pointer variable assignment method
There are three ways to allocate pointer variables: int i 1, i2, i3.

1, nt * p 1 = &i 1, * p2 = i2 assigns a value to a pointer variable whose basic type is integer.

2、p 1 = & amp; i3; Assign the pointer variable the address of the variable.

3、p 1 = p2; Assign values to pointer variables through pointer variables.

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.

Extended data:

Examples of three ways of pointer variable assignment:

1. mode 1: int i 1

I = 3;

* I _ pointer = 3;

2. Mode 2: int i2

int i,j;

int *pointer_ 1,* pointer _ 2;

Pointer _1= & Me;

pointer _ 2 = & ampj; ?

3. Mode 3: int i3

# include & ltstdio.h & gt

void main()

{char *string = "I love China!" ;

printf("%s\n ",string);

}

Baidu Encyclopedia: Pointer Variable