Hi, everyone.
So in the last video, we discussed this question, can't the occurrence of an element and we also write
the code.
So this was the code current function.
I was passing a variable by reference and I was updating that variable, and then I'm bringing my answer
variable inside the main function.
So there is another way to solve this question.
So how we can solve this question.
So what we will do.
So first of all, this is an Mexi, so I will check whether X is present at this index or not.
So if Elfy is equal to X, so if this is a situation, what I will do, I will return one plus.
The number of times is present in this area, so I will call the guys on this area and we're just decided
the cities function E and I bless them.
So this function, this occasion will give me how many times X is appearing inside this, Eddie.
And since X is also present at this position, so I will do one plus whatever the answer, the question
will return me in the ls part, what I will do, return zero because X is not present here.
So return zero plus the number of times X is present in this area.
So the equation will give me how many times X is present in this area.
So I will call function and I plus one type of my function will be void so that I don't know the function
is sorry, the head of the function is void, but in this case they're able to function will be deja
will return.
How many times the element is present I'm repeating again.
So first of all, I will check whether X is present at this index or not.
So if it is present, then I will return one plus the number of times X is present inside the city.
So the equation will return how many times X is appearing and I will do one, plus I will return one
plus because X is also present here.
Otherwise you need to call the equation on this area.
But since X is not present at this next.
So that's right.
Zero plus or if you don't want to write, you can remove zero from zero.
So you can just click on.
So let us write the code, so in order to have the function will be integer, we are going to return
how many times the element does present the name?
The function is count two.
So let's do one thing.
Let's copy this entire function.
And then we will change inside dysfunction, so first change that we need to do is basically the name
of the function is going to we will not take a variable answer.
We will return.
How many times?
It is present, so if I become a question, I will return zero.
Similarly here what I will do so return one.
Plus I'm writing this corrugated one.
Plus it's copied this.
Quality can't function.
So can't function will give me how many times the element of surprise inside count to.
And in the early part.
So in the part, I will return zero plus count to function.
And remove the answer variable, so I'm writing this here, OK, and this is the best case exactly like
this, but here it by percentages, so I'm returning zero.
Simple, so zero plus doesn't have any significance, so you can remove zero from here, so let's do
that and then let's try to Rahnavard.
So let's call the function.
Count two, so let's remove answer.
Let's move on set here and let us also this dysfunction.
And let's name this function count only.
So let's spend.
See out the name of the function is called.
So Ben is not pleasant.
Inside, there is output should be zero.
So we are getting zero.
OK, so let's change the value, let's say five, so five is present three times.
So we are getting three now, let's try four, six, six, two times in the area.
So percent two times now.
Let's check what, seven seven is present only one time, so I should get one.
So I am getting one.
So basically our function is working.
So this is the end record.
So this is not their way of writing the function.
So this is it from this video.
I will see you in the next one.