Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<time.h>
- #include<string.h>
- char* myStrStr(const char *s1, const char *s2);
- int main(){
- char* haystack = "I like to move it move it";
- char* needle = "move";
- clock_t start, end;
- double myStrTime;
- double stdStrTime;
- start = clock();
- myStrStr(haystack, needle);
- end = clock();
- myStrTime = ((double) (end - start))/CLOCKS_PER_SEC;
- start = clock();
- strstr(haystack, needle);
- end = clock();
- stdStrTime = ((double) (end - start))/CLOCKS_PER_SEC;
- printf("Mine:%f\nStandard:%f\n", &myStrTime, &stdStrTime);
- printf("%d", myStrTime);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement