Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

need help in the string length function

$
0
0

here is my code to find out the length of the string.

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)
{
int l=0;
while(
s != '\0');
{

 l++;        
 s++;

}

return (l);
}

cant figure out the problem please help. (making in codeblocks)


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>