How can I count the number of times a specific letter appears in a c-string?

...
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
int function1(char *pointer, int size)
{

	int numberofW = 0;

	for (int n = 0; n < size; n++)
	{
		if (pointer[n] == 'w')
			numberofW++;

	}
	return numberofW;
}
....
Last edited on
Topic archived. No new replies allowed.