The defined function has a return value and the function call can be an argument to a function, but it cannot be a function of the parameter __

Source: Internet
Author: User
Tags function definition
1, the problem description

If the defined function has a return value, the following description of the function call is incorrect (D)

A the function call can exist as a separate statement

B) function calls can be as arguments to a function

C) function calls can appear in an expression

D) function calls can be used as parameters of a function


Parsing: The return value exists in the register and has no address and cannot be used as a formal parameter but can be an argument. 2, the shape participates in the actual parameter difference

The formal parameter appears in the function definition and can be used throughout the function, leaving the function unused.
The actual parameter appears in the keynote function, and the actual parametric can not be used after the function is transferred .
The function of formal parameters and arguments is data transfer. When a function call is made, the calling function transmits the value of the argument to the parameter of the called function to realize the data transfer of the keynote function to the modulated function .


1. Parametric allocates memory cells only when called, releasing the allocated memory cells at the end of the call. Therefore, the formal parameters are valid only within the function. When a function call finishes returning the calling function, the parameter variable is no longer available.
2. Arguments can be constants, variables, expressions, functions, and so on, regardless of the type of argument, they must have a definite value to pass the value to the formal parameter when the function call is made. Therefore, the actual parameters should be given a definite value by means of assignment, input and so on.
3. Arguments and formal parameters should be strictly consistent on a quantity, type, or order, otherwise a "type mismatch" error will occur.
4. The data transfer occurring in the function call is one-way . That is, the value of the argument can only be passed to the formal parameter, and the value of the parameter cannot be transferred back to the argument. Therefore, during a function call, the value of the formal parameter changes, and the value in the argument does not change.
5. When formal parameters and arguments are not pointer types, when the function is run, the formal parameters and arguments are different variables, they are in different places in memory, the contents of the arguments argument are copied, and the parameters are released at the end of the function, and the argument content does not change . and if the function's argument is a pointer type variable, in the process of calling the function, the function is passed to the address of the argument, and the address of the argument is used inside the function body, which is the argument itself. Therefore, the value of the argument can be changed within the function body.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.