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.

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;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!