In your len function, you were accessing a character not a pointer. so s++ is next character alphabetically not next character of the string. if your parameter is accepting a pointer then s++ would be next element of string or character array
include <stdio.h>
include <stdlib.h>
int main()
{
char st[ ]="hithere";
printf("\a");
int i;
i=len(st);
printf("%s",st);
printf("\a%d",i);
return 0;
}
int len(char s[]) // or(char *s)
{
int l=0;
while(s != '\0');
{
l++;
s++;
}
return (l);
}