Now, let's say that you are writing to a and actually what you want to know is what base is left on
your cue or how much is occupied already by your AQ.
So this is very important in order, let's say, to prevent errors that could emerge from writing to
a like.
You know, the way to do that is by using two functions.
The first function is called you execute messages waiting and you execute spaces available.
So I'm going to create two variables in the first one is an integer.
I'm going to call it messages waiting.
It's going to equal to you x que.
Messages waiting, though, this function here, if you pass the cue to it, it's going to return how
many messages are already occupied in the queue?
So here we need to pass the queue.
We are interested in which is the excuse.
All right.
So right now we are storing how many messages are already in the queue.
Now, how about if I want to check what the free space in my queue?
Well, we create a new variable and we're going to call it available queue.
Thijs.
It's going to equal to you excuse.
Basis.
Available and we're going to pass executer.
OK, so those two functions are going to return the status of MICU.
Now let us print messages.
Eating.
And I'm going to print the messages waiting count, let us print the space here, because we're going
to put everything on one line.
So print is how we create a space after.
Printing evaluable.
Next, we are going to print the available messages.
So, again, Serial.
Prince.
Available.
Based.
Serial entrepreneur, Glenn, because we need a new line of the writing, everything on one line.
Available.
You.
Thanks.
OK, so my unit is connected, let us try to upload this, OK, we forgot the double quotation here.
OK, and you're applauding.
The check the through your monitor, as you can see now.
His rating.
Oh, OK, we have another issue.
This is a variable variable that.
Not a statement to print.
Here we go.
Just waiting is one available, OK, for this is what we have sent.
Then again, the the waiting messages is increasing until we have five waiting messages in the queue
and we have no space available at all in my queue, as you can see here, messages waiting is increasing
and space available is actually decreasing.
We have filled the queue with five values and our queue already can fit five integers.
So that's it.