When passing pointer parameters, you must note that pointer Transmission
Passing pointer ParametersNote:
When the parameter pointer in the main function is passed to the parameter pointer of the called function, it means that the two pointers point to the same memory unit. In this case, when the called function uses the form parameter pointer to operate on the memory area, it is very likely that the two pointers (the form parameter pointer and the real parameter pointer) Point differently. This is not just caused by the malloc function (which denies the previous point of view ). If the parameter pointer still needs to be completed in the main function, it is wise to return the parameter pointer to the main function.
To stay away from this inconsistency, the best way is to always return.
PS:If you do not need to use the parameter pointer in the called function after the main function is called, you can safely use the parameter transfer between pointers and do not need to return it. In this case, you can also use the get address operator & to pass the address of the real parameter value to the shape parameter pointer of the called function.