i have to write a function
int find string(char *s, char *t)
that finds the first place at which the string t occurs as substring of the string s, and
returns that position, if one exists, counting from 0, and -1 if none exists.
E.g., for s=
“example” and t=“ample” the program should return 2, for the same s and t=“exam”
the program should return 0, and for t=“error” it should return -1. The strings s and t
are \0-terminated strings.
Im having trouble getting started with this assignment. i was just wondering how to go about starting this assignment, ive tried some things but it seems what i was doing in the first place was wrong, i need to start fresh and i would like a push in the right direction
int find string(char *s, char *t)
that finds the first place at which the string t occurs as substring of the string s, and
returns that position, if one exists, counting from 0, and -1 if none exists.
E.g., for s=
“example” and t=“ample” the program should return 2, for the same s and t=“exam”
the program should return 0, and for t=“error” it should return -1. The strings s and t
are \0-terminated strings.
Im having trouble getting started with this assignment. i was just wondering how to go about starting this assignment, ive tried some things but it seems what i was doing in the first place was wrong, i need to start fresh and i would like a push in the right direction
Comment