C FunctionsLesson 24Free preview
C Function Parameters
This lesson is part of C · All levels
Summary
A parameter is a variable declared on the signature of a function to receive a value from the caller, whereas an argument is the actual value sent when the function is called. C uses call by value, meaning that the function receives a copy of the argument so that changes within the function do not affect the original variable. To influence the original data, send addresses using pointers as discussed in the pass by reference lesson. The number and type of argument must be consistent with the declaration of the parameter.
Key points
- Parameters are declared in the function definition, the argument is sent when calling
- C default using call by value
- Changes in parameters within a function do not change the caller's original variable
- Parameters copy requires a little extra memory for big data
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.