Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What do return values, formal parameters and real parameters mean in C language, and how are they used?
What do return values, formal parameters and real parameters mean in C language, and how are they used?
Because the value of the main function needs to be passed to the calling function when calling a function, the calling function must return to the main function after using this value. If it is borrowed, it will be returned, but it is not necessarily the original. Most of them are returned after processing, just like you give things to others for processing, and they will return them to you after processing. !

But the function does not have to be reversed. It doesn't have to be returned, just like you lend something to others. As long as that person tells you the result, then you don't have to return it!

Parameter passing is mainly used for modular programming. If you don't understand parameter passing, you can't write the correct calling function. A formal parameter is a formal parameter, and a variable represents everyone. Real parameters are actual parameters. The exact numerical value can be an expression, not a formal parameter. The number, type and order of actual parameters and formal parameters should be the same. If not, the system will force conversion, which will cause data loss. The transfer of real parameters to formal parameters is the transfer of values.

This value is the calculation result of real parameter expression, which can be constant value, variable value, array element, function value, etc. If the parameter is an array name, it passes the value of the address. For example:

Double power(double x, int n) defines a double precision parameter.

Power (3.0, 5) call

X n is a formal parameter, and 3.0,5 is a real parameter. If the integer multiple power (int x, int n) is defined above and the power (3.3,5) is called below, then 3.3 in the independent variable will be converted to 3, and some data will be lost.