计算字符串中e和k间的字符数,运行结果怎么不对
#include <stdio.h>
int count(char *q)
{int i,k=0;
for(i=0;*(q+i)!='\0';i++)
k+=1 ;
return k;}
int countek(char *q)
{ int i,k,g,m=0;
for(i=0;*(q+i)!='\0';i++)
if(*(q+i)='e') /*找E,如果找到E,则从E后开始计
数边开始直到找到K ,从K后面再开始找E*/
{g=i+1;
while(*(q+g)!='k')
{m++;g++; } ;
i=g;
}
printf("%d\n",m);
return m; }
main()
{ char a[80],*p;
p=a;
printf("input the string:\n");
scanf("%s",p);
printf("%s\n",p);
printf("the number of the letters is %d\n",count(p));
printf("the number of letters betwen e and k is %d\n",countek(p)); }