Hello, and welcome to the 29th tutorial in the c++ programming series. And in this part, we're going to be looking at functions. Functions allow code to be grouped together and only run when the function is actually code, the function can be called several times, which is pretty cool. So if you have a block of code, you don't actually need to repeat that code several times. I mean, you don't have to actually write it several times. So another benefit of that is if you need to change the code just propagates through the entire application.
So it helps consistency and keeping everything up today. So let's just show you how to use functions. Okay, the syntax for a function and you declare it technically this is a function right here. This is the entry point of the application. So what you do is you put the return type for this tutorial, we'll put void the next tutorial will actually be looking at a different return. Type and you put your function name and call it print function.
Literally the only requirement for the function name is that it's not keyword like int or STD colon colons yet, then you put curly braces, and in here you put whatever you want to do, we're simply just going to do a C out on a function printed this line and to call this function, all you do is use the function name which is print function, open close bracket, this is what actually differentiates a function between a variable in this put semi colon. Now if you run it, it's got the nine function printed, this has been printed out in the console. One thing to note is a function can be declared after it is cold. Then if I put this after the main and run it failed because it's trying to call this function and technically doesn't exist yet. But what you can do is implement a prototype or declare a prototype or say what you do with it, you do like void.
Print function has to be the same name, obviously, open close bracket, and then you just press semicolon. That is it. So he knows that this function or this necklace implemented afterwards is quite common practice if you're distributing within one flow, because he helps you organize your code a lot better than if we just run this. So it's printed out even though it wasn't implemented till after the function. We're also in copper disorders. And we're looking at parameters arguments for your functions, if you have sorry about that notification.
If you have arguments within your function. You don't have to specify the name here. But if you do you have to make sure the name is consistent when you actually implement the function. That is it for this tutorial. If you have any questions, feel free Greeting messages a sonar system with credit card the email will be in the description. You can comment on this video or just direct messages via YouTube or the requiring full source code will also be in the description.
In the next tutorial we're going to be looking at the function return statement and as usual, thanks for watching. I hope you have a nice day.