Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function which has a prototype: int myfind(char s[], char c, int start);

ID: 3643798 • Letter: W

Question

Write a function which has a prototype: int myfind(char s[], char c, int start); The function should begin searching the string allocation start for the character c. The function should return the position number of the first occurrence of the character c. If the character does not exist in the string, the function should return -1. You may not use any built in string functions except for strlen(). For example (This is only an example. s[ ] can be any string): char s[]={"Space, the final frontier" }; char t[]={ "These are the voyages"}; char u[]={"of the starship, Enterprise"}; int a, b, c; a=myfind(s,'f',15); //a set to 18 b=myfind(t,'e',0);//b set to 2 c=myfind(u,'E',0); //c set to 18

Explanation / Answer

int myfind( char s[], char c, int start ) { int l = strlen( s ); int i; if ( start < 0 || start >= l ) return -1; /* Invalid start position! */ for( i = start; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote