What do you mean, argument parameters, how to use the difference

Source: Internet
Author: User

Formal parameters: All called "formal arguments" are parameters that are used when defining function names and body functions in order to receive the arguments that call the function Shishung.
Arguments: All called "actual arguments" are arguments that pass a function on the call.

The types of formal parameters and arguments must be identical or conform to the implied conversion rules.
When a parameter and argument are not pointer types, when the function is run, the parameters and the actual
The arguments are different variables, they are in different positions in memory, the shape arguments real
The contents of the argument are copied, and the parameters are released at the end of the function run.
The actual argument content does not change.

And if the function's argument is a pointer-type variable, the procedure for calling the function
, a function is the address of an argument, which is also used inside the function body.
The address of an argument, that is, the argument itself. So inside the function body
You can change the value of an argument.

To give a very simple example: int f (int b)/*/b is a parameter */
{return B;}
Main ()
{int a = 1;
printf ("%d", f (a)); /* A is an actual parameter */
}

And one of the stupidest ways is that the function defined in the letter is called "argument", a function outside the function, "parameter."

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.