In this lecture you will learn about the void function here.
So in some cases you will need to indicate that a function does not have parameters or will not return
a value.
So in both cases you can use the keyword void here.
So let's create an example application about void and then continue our lecture.
So first void, this function will return a void here.
So let's for example, let's print a message with this void function with void parameter here, void
message, void here.
And then.
Here.
Let's print some value.
For example, no inputs.
No.
Return value.
Value here.
And then as you can see, we will not return any value from it because this is a void function and this
will give us an error.
So in void functions you can not return a value.
So this functions in this function has only purpose is to print message on the console here, as you
can see here.
So let's write our main function.
So as you know, main, our main functions does returns something, returns integer 1 or 0, or you
can return ten, but usually that does not happens here.
Integer void integer main function.
And then let's call our print message message function, as you can see here, print message function.
So now we can run our application, compile our application and run and let's see what our output is.
So let's run our application.
And as you can see, no inputs, no return value.
So the use of void in the parameter list is optional, so you cannot use it as well.
So an empty pair of parentheses is acceptable and preferable.
So you don't have to do this all the time.
It's preferable to just leave it empty.
You don't need to add void function here, so avoid the keyword here.
So we will make this empty.
As you can see here, I did this on purpose to show you why to do this and not so.
And this is the only way to indicate that the function returns no value other than returning void.
So note that the void is not really a type because you cannot create a void variable.
So it is the absence of a type.
As you will find out in the next lectures, you can create a pointer of the type void, but you will
not able to use the memory that such pointers point to without casting to a typed pointer.
So to use the memory, you have to decide the type of the data that that the memory holds.
So that's it about the void function in this lecture.
But later on this course you will learn more about the void and void functions here.
So see you in the next lecture.