Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
What is going on, guys?
I hope you are doing well and I hope you've successfully passed the previous introduction to functions.
This will definitely make your learning process much easier from now on.
So now let's get to work and talk about functions now or C programming language.
And first of all, what I want to talk about here in this section is that every function has its signature.
So we'll will say that signatures.
Correct arises the function.
OK.
So a signature correct.
Arises the function.
It simply describes the functions name.
OK.
And it also describes the functions expected parameters list.
We will talk about it.
We will talk about that.
And we also said that we can expect that the function may return something.
So basically the signature will also specify this one.
What will be the returned type of any given function?
It will simply say what type of data the function is expect.
And and it's going to return in its template to looks basically like this.
First, we specify the return type.
Then we specify the functions name.
And lastly, we specify what are the expected parameters that the function should get.
Once it's called.
So this structure or first of all, the return type.
Then the function name.
And then the parameters list.
It's called a signature in our C programming language.
That that's how we characterize a function.
OK.
And the main three things to note here are what type of data?
The function is going to return.
OK.
So we know that we may have different types of data.
Right.
We have integers.
We have floating points, characters, strings and so on.
And what we would like to do is to specify before we are even using any function.
What will be the type of data that the function is going to return?
So, for example, the return type can be into double char and so on.
OK.
Simply specify the type of data that these function is about to return.
Just like with the explanation we had in the previous videos where we said that we may think of every
function as some guy with some profession.
And for these guy, the return type basically means what will you expect to receive?
What what should you receive?
Once the guy.
Of these guy, these functions, these join in this example will finish his execution.
And what what will what we expect to get in return once it's done.
OK.
And there is also something new to mention here.
There may be functions that will not return anything, anything at all, and that's OK.
So in this case, instead of using into double or char as part of the signature.
When we wanted to return some type or some value.
OK, we are going to use void.
And that's how it looks like, OK.
So Void specifies that we do not expect that a function will return anything.
Okay.
We can just call it, for example, a function that all it does is simply to print some information
to the screen to display something.
We don't expect to receive something in return from this function.
OK.
And I've just notice that I'm saying a lot of times in this video, the world.
OK, so let's stop it.
OK.
And if we come back to talk about the functions.
So one function, John, will return an integer and Mary will return nothing.
And that's all.
Also.
OK.
So now let's talk about the functions name, which is simply the name of the function.
You remember John, don't you?
And we should give every function in name so that we will be able to distinguish between different functions.
When we are going to call them.
So the function name is very similar to a variable name and you can name or function however you like.
Just don't use any reserved words or something that we can not using, see.
OK.
And once again, this OK.
And my suggestion for you guys might tip for you when you're using functions.
Never get lazy about naming your functions.
And always try to give your functions such a name that will describe its purpose.
What it does in the best possible way, because you see, as you keep on moving forward and developing
much greater programs, you are going to have a lot of functions.
And even the naming of them was bad.
Then you're probably going to experience a lot of difficulties in managing your code and all of your
program is going to become one big mess that you will be the.
You won't be able live in two to be capable of reading.
And I'm not even talking about further development.
So if the function calculates the average of something, make sure that the name will represent at least
the fact related to the average or if the function is responsible for the like button.
Let's see that is being used on some social media.
Make sure that once you read the functions name, you already understand, at least to some extent,
what this function does.
So, for example, in our previous sections we've written some code that prints out the minimum and
the maximum between given two numbers.
So the function name may be at least print mean marks.
OK.
It says what these function will do, it will print and perhaps it will print minimum and maximum.
Or maybe if we have some other function that calculates the average grade than in this case, we will
call this function find average grade.
OK.
So we see the name of the function and we understand what these function mainly does.
OK.
So the general concept of the function, we can guess just by reading its name and that's very important.
And so lastly, we have also the functions expected parameters list.
OK.
You remember that a function is just like someone with a profession.
And whenever you call him to do something, you pass him.
You give him a couple of things.
So, for example, if you're using a painter that paints your house.
There may be some parameters that we would like to give these painter before are he or she starts his
or her work.
OK.
Like the color.
We want to use your address where you live and how much money can you offer.
So I hope that's clear for him, for this example, of what parameters a painter may may want.
OK.
So a color address, money and so on.
Or if there is another example, let's talk about another example where we have a function to print
the minimum and the maximum.
Between two numbers.
Then the function in this case definitely should receive two number assess parameters.
So number one.
And number two.
And basically, once it's receives the numbers, it will print the meaning moment, the maximum between
these two, number one and number two.
So to summarize it, every function may include multiple parameters that it will expect to receive once
somebody calls it.
And this list may also be empty, meaning no parameters at all.
And that's OK.
It's not mandatory.
We may pass a couple of parameters and we may also do not send anything.
That's fine.
A function does not necessarily should have a list of parameters, but it may have it.
So now once we're done with all the formality, we are going to take a look at four exercises that each
of them is going to use some different type of functions.
In terms of a return type.
And as well as a name, of course.
And every function he's going to use at different.
Let's call it a different set of parameters list.
I want you to to see are all, let's say, the standard options for functions that we can have.
So basically there are going to be four examples and function.
No one will be with no parameters and nothing in that it will return.
So would be will be of a void type.
And this function, all it's going to do is simply to print a greeting message to the screen.
So we are going to develop this as our first exercise.
Then we are going to take a look at the second function and function number two.
That will contain some parameters.
But it will return nothing.
So it still will be of a void type.
And what we are going to do in this function, in these second function, is that we are going to receive
two numbers.
Number one and number two.
And then print the maximum and the minimum between them to the screen.
But it will not return anything.
OK.
Please note that there is a difference.
It's very important difference that you must understand between returning something which is an internal
functionality between functions and printing to the screen, which is a totally something different.
OK.
It simply displays some text on the screen.
So make sure you understand the difference.
Because it's crucial for our future sections.
And once we are done with function number two, we are going to proceed to function number three, where
we are going to have no parameters at Oles at all.
But we will ex.
React to, first of all, receive something in return.
Once we called these function.
So we are going to write a function that gets nothing is a parameter, but reads from the user three
numbers, which are going to be local only to this particular function.
Right.
And then the function is going to find out and return the maximum value between these three variables
or values that we read from the user.
And lastly, we are going to take a look at function number four, which has some parameters.
And also, we expect that it will return us something.
So this function is going to receive three grades.
Okay.
It's going to receive your three grades, calculate and find out the average grade and then return it
to whoever called it.
So as you can see, there is a lot of content, a lot of information that we are going to study and
to learn in these our exercises.
And this of variance of functions.
And hopefully, once we practice this topic a little bit together, you will be able to proceed to other
challenges on your own.
That's our main goal, to make you prepared for handling things and writing functions on your own.
So, guys, with that being said, let's move on to solving our examples.
I'll see you there.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.