Question: Write a function to accept a vector of chars and a char and return a count of how many times the char appears in the

Write a function to accept a vector of chars and a char and return a count of how many times the char appears in the vector.
Choose the answer below that best implements this function.
```
int countChar(const vector &V, char ch)
{
int count;
for(int i =0; i V.size(); i++)
if (V[i]== ch)
count++;
return count;
}
```
None of the other answers are correct. ```
int countChar(const vector &V, char ch)
{
int count =0;
for(int i =0; i V.size(); i++)
if (V[i]== ch)
count++;
return count;
}
```
```
void countChar(const vector &V, char ch)
{
int count =0;
for(int i =0; i V.size(); i++)
if(V[i]== ch)
count++;
cout "The count is " count endl;
}
```
Write a function to accept a vector of chars and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!