After the return trip.
Uh, the parameters.
The function name.
And have been determined.
You need to define the body of the parameter.
So we're going to first, uh, make the return time, then our function name for some.
My function, uh, the parameters for this function is going to go, for example, my integer.
And this is the function.
Uh, but here.
So the code for a function must appear between a pair of braces here, as you can see here.
So if the function returns the value, then the function must have at least one line.
The last line in the function with the return statement here.
So this must return the appropriate type or type that can be implicitly converted to the return type
of the function.
So as mentioned before, if the function is declared as auto here, the compiler will deduce the return
type.
So in this case, the return statement must return the same type.
Now, when a function is called the compiler checks all the overloads of the function to find one that
matches the parameter in the calling code.
So if there is a no exact match, then the standard and those are defined.
Type conversions are performed, so the values provided by the calling code may be different type from
parentheses here.
So parameters.
So by default, parameters are passed by value and the copy is made.
So which means that the.
Parameters are treated as local variables in the function like that here.
So you can't use the my integer variable outside the function here though these are the just local variables
that you can use these variables inside the function.
So.
Uh, the variety of the function can decide to pass parameter by reference either through the pointer
or a C++ reference.
So pass by reference means that the variable in the calling code can be altered by the function, but
this can control the by making the parameters constant here.
So in which case, the reason for passing my reference is to prevent the potentially costly copying
being made.
So the built in arrays are always passed as a pointer to the first item to the array.
Here, the compiler will create the temporaries when needed.
So for example, when a parameter here for example, it's called void, F the F when a parameter is
a const reference and the calling code pass the pass as a literal.
A temporary object is created here and it's only available to the function here.
Let's go to the function float and here we're going to make the F here.
F 1.0, for example, or double double d d equals.
2.0.
As you know, this is the plot number.
And here.
And we're going to.
Add the F pass the the variable, the double variable to the r f function here, which returns nothing.
But we have a const parameter here.
Be.
So here this is OC OC and temporary float is created.
And this is actually the almost the same.
And it's OC and the temporary float is created here actually in this, not in this line.
In this line we have a OC and it called can compile successfully.
And in F when we pass 1.0 as parameter, the temporary float is created.
And then when we're going to pass the D as a parameter, the temporary float is clearly created as well
here and we can pass the initialize our list list in this function here so you can pass, initialize
our list as a parameter if that list can be converted to the type of the parameter.
So for example, let's we're going to create the another struct here.
Actually, we can delete this course and we can create another structure.
We can delete this as well.
Struct point.
Here this going take integer x here integer a or integer integer P here.
Here.
So we're going to make the under function name set point.
And the point, as you can see, the point is a struct.
We're going to take the point struct as a parameter.
And name it Pete here.
So in the main function, we're going to code a point.
We're going to create a point object named P and reach the P dot A equals fun and P dot B equals one
as well.
And here we're going to set point.
We're going to use the set point function and we're going to pass to pass P as a parameter and we're
going to set point here.
Uh, using the color braces.
Your one and one here.
And, uh, we're gonna return zero, as always, in the main function here.
So.
This code defines a structure that has two members here.
Actually, let's make it look nice here like this.
This structure has a two members, and in the main function, a new instance of point is created on
the stack and it is initialized by accessing their members directly.
So the instance is then passed to a function that has point parameters.
And since the parameter of set point here, set point is passed by value.
The compiler creates a copy of the structure on the stack of the function here.
And the second call of the set point does the same.
The compiler will create a temporary point object on the stack of the function and initialize it with
the values in the initialized list.