I'm trying to write a function which will return number of occurences of a character in a string. For exampale, "o" is found 2 times in "london".

int nchar(char* s, char* m)
{
int i=0;
while(*s != '\0')
{
printf("chars are %c,%c\n",*s,*m);
printf("ascii value %d,%d\n",atoi(s),atoi(m));
if(strcmp(s,m)==0)
{
printf("matched");
i++;
}
s++;
}
return i;
}

I also tried with atoi(*s)==atoi(*m) instead of strcmp but still doesn't work (compiles but can't find match)

I'm calling the function as follows

int j=0;
j=nchar("london","o");
printf("found times %d\n",j);

Please help.
thank you.