I am trying to count the characters in a linked list.
I am receiving a compiler error when this function is tested...
**invalid types `char[int]' for array subscript **
int slist::count_c(char c) const
{
slistelem* temp = h;
int count = 0;
for (int i = 0; i != '\0'; i++)
if (temp == c[i])
count ++;
return count;
}
How can I fix this function to properly display desired results?
With a function call such as
cout << l.count_c('b') << endl;