So next part, this function declaration here is where we declare the function, we will introduce the
compiler, our function with its definition.
So suppose I am planning to add numbers three and five and I should have an option to create the function
cards, some which accept this variables, let's say and b, and it should be only accepting integer
numbers, not floating by numbers.
So how should I define the function?
So you, as you know, my function, is aimed at adding two numbers.
So my function will always act on numbers and get another number.
I set the static audits and indigena, but I say it isn't.
If I am doing this, I will get that indigenous instead.
So here it shows this is the return date, which means when this function is getting executed, that
when the function name some is getting executed, that it will return a value with the return date int.
Now this function named some will accept new variables for operations.
It's a and b, so suppose if I am leaving like this some.
Three comma, five.
Exactly this function will exit three here on air and five here on B.
Then what will happen, the rest of the card is included in this.
So we will be putting a brace and giving the function definition.
So here we are planning to see out of print.
We are inside the some function and some may be that variable also have been declared yet.
So here is three when I use this s Garling statement, this will be here and this will be B.
So five plus three is eight.
So here we have a written statement, which is eight, which will give that man.
We have guard this support.
I have got some e going to let it be in.
Some may go to some or some function.
This is some function, some of it comma certified comma three.
Then it will be like going like this, so it will be calling this definition.
It will be giving.
Now I have changed about using that change the values.
So anyway, some snake bodies equals anyway.
This will be five and this will be three.
Then it will be it is playing inside some function, then will be doing five plus three.
It will be eight and then it will return some, he added.
This is the return date.
So what happens?
It will return the value of something that is eight that will come out here.
So the result will be some will be eight.
And one more thing you have to note, I have declared to some media, which already had one is inside
the function and one is outside the function.
So both will be different because this variable was just declared inside.
The function will be a local variable and the other one will be that variable out of scope.
That means it may be able to be just defined inside the function well in its scope.
Scope means its value will not be accessible.
After we leave that particular function so it can be defined, all here will not be accessible beyond
this function.
It will be still that.
So that's why we are returning this summer because some is deleted or some is removed from the memory
just after this function has exited.
So in order to proclaim that some variable or some value, we need to return that.
And that's why we are using added turned back over here.
Hope you have, I'm not sure.
So there will be three important box which will be inside a function.
Why this function declaration, which will show that return type of the function name of the function?
The argument is accepted by the function any number of arguments function can, except suppose we can
also create a function that accepts 10 number SoyNut.
Some.
India coal mine to be karma in the sea, etc. Likewise, we have we can divine any number of arguments
and the function will be able to process that and modernise like air function can always avoid returning
memories.
This written statement is optional.
Suppose if I don't want to return to some, I just want to print it right away here I can just put out
a statement.
But in the summer here and I can remove the statement, and if there is no written statement or return
time, then they function.
The return date should be void.
That's it.
That's the only thing I would do.
Make sure.
So anyway, I have explained to you everything on here, it says, anyway, began gems Typekit right
away and do it smaller demand functions.
So let's jump in visual studio code.
So here I have a.
Program created for you and scored fine, send out CBP here.
We have declared a complete we have written a complete program which is used to add two numbers, but
using function.
So here you can see a preprocessor Dorothy Namespaces declared out here, then we can see the next statement
is functioning prototype, and it will be just giving an introduction to compiler that there will be
a functional definition ahead.
And the final senator turntable will be in the final version, namely, the addition and the final change
variable is which accept will be A and B.
So this is just an order we know yet again.
See, we have to mostly like re-edit and addition variable created to store the value add and then a
reading two numbers.
Number one and number two.
Then I'm calling the function to add this number one and number two.
So what happened at equal edition number one and number two?
Then straightaway, the control will be going to here.
That means the function definition here, what you can see in the addition it will accept and the NBA
in the sense, the number one which we have provided will be here.
And number two will be b OK and it will return a plus b, whatever number I have given us, number one
and number two will be stored on standby B.
And if then add these two numbers and B and return that value to that column.
This is that calling function for a function call place, he added.
In return, the value of fatty and it will store the value to this medium now just on the next statement
and pending the addition value.
See, this function is created just after the main function is closed, so you can either create a function
inside the main function itself or you can create it outside, but that's fine.
So if we are, that's why we are providing you function prototype power here, which means the program
doesn't end after the main function.
There are some functions also defined outside the main function.
So now let's see this program in action so that you will understand this problem.
So let me switch to my desktop directly.
Now I'm going to do C++ compiler this program function doc CPB.
Successfully done by now, I am going to get the output.
So it's asking me for the first number I'm giving.
Well, it's asking me for the second number I'm giving.
I gain.
18.
So it will be 30, right?
Let's end up right.
Irishness 30, what happened and first number, he here to execute that no one is 30.
Sorry, Brad.
And number two, he's 18.
So I'm passing this tour.
I am going to show leg and add these numbers and return them to here.
And I'm bringing this back.
That is 30.
That's it.
Hope you have understood this concept.
Now we can jump back to our presentation.
Bed, we have something more to let.