Академический Документы
Профессиональный Документы
Культура Документы
RODRIGO
BSCS IC
~~~~function_name is the name of the function (which must also be the name of the m-file it is in)
~~~~The return type of a function establishes the size and type of the value returned by the function and
corresponds to the type-specifier in the syntax
~~~~The return type given in the function definition must match the return type in declarations of the
function elsewhere in the program. A function returns a value when a return statement containing an
expression is executed. The expression is evaluated, converted to the return value type if necessary, and
returned to the point at which the function was called. If a function is declared with return type void, a
return statement containing an expression generates a warning and the expression is not evaluated.
B. Function name
~~~~A Function object's read-only name property indicates the function's name as speified when it was
created, or it may be rather anonymous or ''(an empty string) for functions created anonymously
C. Paramete
~~~~a numerical or other measurable factor forming one of a set that defines a system or sets the
conditions of its operation.
"the transmission will not let you downshift unless your speed is within the lower gear's parameters"
D. Function Body
~~~~A function body is a compound statement containing the statements that specify what the function
does.
~~~~The call by value method of passing arguments to a function copies the actual value of an argument
into the formal parameter of the function. In this case, changes made to the parameter inside the
function have no effect on the argument. By default, C programming uses call by value to pass
arguments.
~~~~~Before we discuss function call by reference, lets understand the terminologies that we will use
while explaining this:
or
In this guide, we will discuss function call by reference method. If you want to read call by value method
then refer this guide: function call by value.
~~~~When we call a function by passing the addresses of actual parameters then this way of calling the
function is known as call by reference. In call by reference, the operation performed on formal
parameters, affects the value of actual parameters because all the operations performed on the value
stored in the address of actual parameters. It may sound confusing first but the following example would
clear your doubts.
#include <stdio.h>
*/
*var = *var+1;
int main()
int num=20;
*/
increment(&num);
return 0;
Output:
Value of num is: 21