Hello, i want count chars in others char. For example:
Input:
111666349
find 6
output:
The number has 3 digits.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <stdio.h>
#include <string.h>
int main ()
{
int i;
char strtext[] = "111666349";
char cset = '6';
i = strspn (strtext,cset);
printf ("The number has %d digits.\n", i);
return 0;
}
You need a different function, this one doesn't do what you think it does - even if you call it correctly. The function argument are both char arrays, not a char for one of them.
It is easy enough to loop through the string and count em :+)