Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.37 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. static int contains_back_to_back_doubles(const char *word) {
  2.         char last = '\0';
  3.         while(*word) {
  4.                 if(*word == last) { /* Found first double */
  5.                         if(!(last = *++word))
  6.                                 break;
  7.                         if(*++word == last) { /* Found second double */
  8.                                 if(!(last = *++word))
  9.                                         break;
  10.                                 if(*++word == last) /* Found third double */
  11.                                         return 1;
  12.                         }
  13.                 }
  14.                 last = *word++;
  15.         }
  16.         return 0;
  17. }