MindMap Gallery Data structure (pointer)
Regarding the issues of formal parameters and actual parameters in data structures, let’s learn about them through mind maps.
Edited at 2020-11-01 18:32:14Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
Avatar 3 centers on the Sully family, showcasing the internal rift caused by the sacrifice of their eldest son, and their alliance with other tribes on Pandora against the external conflict of the Ashbringers, who adhere to the philosophy of fire and are allied with humans. It explores the grand themes of family, faith, and survival.
This article discusses the Easter eggs and homages in Zootopia 2 that you may have discovered. The main content includes: character and archetype Easter eggs, cinematic universe crossover Easter eggs, animal ecology and behavior references, symbol and metaphor Easter eggs, social satire and brand allusions, and emotional storylines and sequel foreshadowing.
[Zootopia Character Relationship Chart] The idealistic rabbit police officer Judy and the cynical fox conman Nick form a charmingly contrasting duo, rising from street hustlers to become Zootopia police officers!
Function parameters
substance
Within the main function, define a variable to open up space for the variable
Actual parameters change in main function
The formal parameters open up space, and the space is the address. Any changes made by the function to the formal parameters are changes to the actual parameters.
The actual parameters in the main function remain unchanged
The formal parameters open up space, and the space contains values. The function call is completed and the space is released.
Pass by value
Pass the value of a variable
Actual parameters: Pass the value x of the variable to the formal parameter
Formal parameters:
Re-open a space for the received variable x
Assign the value x of the variable to this space
All operations on this variable within the sub-function are operations on numbers in the newly opened space.
After the sub-function is finished running, the newly opened space is released.
Notice:
The address of the newly opened space node x is different from the address of the actual parameter x
In the main function, the value of the x address has not changed. The operation of x in the main function by the sub-function is invalid.
If you insist on calling, it is the same as not calling
address delivery
pointer
Arguments:
The actual parameter passed is the address
For example: &a, the array is a
Formal parameters:
The formal parameter defines a pointer
For example: int *p, the array is int p[]
substance
The address of the actual parameter is stored in the space opened by the formal parameter.
The use of formal parameters by sub-functions is to indirectly change the value of the actual parameter based on the address in the formal parameter.
pointer reference(c)
Linked list (custom function)
Example: typedef struct student {}node, *list
Arguments
Within the main function: list l; creat( l);
formal parameter
Subfunction: void creat( list &l ){}
Notice:
Although there is & in the sub-function, it can be ignored within the sub-function.
Address passing application example
linked list
stack
Example: pop(stack *l, int *x)
push to stack
push(stack *l, int x)
Example: There is a[3]={1,2,0} in main, define the push function to put a number
Give e to this array
That is, the external value is given to the actual parameter, and the value of the actual parameter changes
The sub-function has finished running and the value of the actual parameter has changed.
pop
Way 1:
The sub-function is pop(stack *l, int x)
The main function is: e=pop(l,x)
The formal parameter opens up space for x, and the number taken out is placed in the space.
The sub-function call ends and the newly opened space is released.
In the main function, e=pop(l,x), the value of x is not given to e, and it is the same as if e is not called.
Way 2:
The sub-function is pop(stack *l, int *x)
The main function is: e=pop(l,&x)
The value taken out is given to x, which is equivalent to giving it to e.