1. Value transfer: Copy the storage content pointed to by the variable to the receiving variable during transfer/assignment. Look at the following code

int num = 100;
int num2 = num;
num2 = 40;
Copy the code

When the third step is executed, a block of memory is reallocated to the variable num2, which holds the value of 40

2. Pointer passing: if it is a pointer, the address of the pointer variable is passed to the receiving variable; if it is an array, the first address of the array is passed to the receiving variable

int num = 100; int *p = # int * p2 = p; *p2 = 55; Printf (" the value of num % d ", num); // The output is 55Copy the code

The code for the first 3 steps is laid out in memory as follows:

1. Declare variable num with the value 100. Assume that the memory address of variable num is 0x00AB

2. Assign the memory address of variable num to pointer variable P, then the value of pointer variable P is 0x00AB. Assume that the memory address of pointer variable P is 0x00DF

3. Assign the value of pointer variable P to pointer variable p2, which is 0x00AB. Assume that the memory address of pointer variable P2 is 0x00EF

When performing step 4p2=55; * change the contents of variable p2 from 0x00AB to 55, and the contents of variable p and p2 refer to the memory address of variable num, so the contents of p and p2 are also changed to 55, but the memory address of p and p2 is still the same.