daily pastebin goal
42%
SHARE
TWEET

indexOf in C++

mvaganov Dec 17th, 2014 165 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // linear search
  3. int indexOf(const char needle, const char* haystack, int haystackSize, int startSearch) {
  4.         for(int i = startSearch; i < haystackSize; i++) {
  5.                 if(haystack[i] == needle)
  6.                         return i;
  7.         }
  8.         return -1;
  9. }
RAW Paste Data
Top