Write afunction int mystrlen(char*s) that returns the number of characters in strings. e.g.,char s[]=program, strlen(s) is 7.
Fantastic news! We've Found the answer you've been seeking!
Question:
Write afunction int mystrlen(char*s) that returns the number of characters in strings.
e.g.,char s[]=”program”, strlen(s) is 7.
You can not call strlen()function in your program.
heres what i have done. help!!
int mystrlen(char *s)
{
char s[]=”program”;
int counter = 0 ;
int i;
for (i = 0; i < s[i]!= 0; i++)
{
counter++;
}
printf( "The number of characters is %d", counter);
return 0;
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: