Created
May 19, 2016 23:08
-
-
Save dvtate/d2f138eaaed0944ac9195cdef83cf66f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char* findOccurance(char* source, char* query){ | |
char* queryCopy = query; | |
while ( *source != '\0') { | |
if (*(source++) == *query) { | |
query++; | |
while (*query != '\0' && *source == *query) { | |
source++; | |
query++; | |
} | |
if (*query == '\0') | |
return source; | |
query = queryCopy; | |
} | |
} | |
return 0; // return NULL if there were no occurances found... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment