Guest User

Untitled

a guest
Nov 28th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. int countRecurringCharacters(char *line) {
  2.     int count = 0;
  3.     char countRepeat[256];
  4.     register int i;
  5.  
  6.     for(int i = 0; i < 256; i++) {
  7.         countRepeat[i] = 0;
  8.     }
  9.  
  10.     while (*line) { //here
  11.         countRepeat[*line]++;
  12.         line++;
  13.     }
  14.  
  15.     for (i = 0; i < 256; i++) {
  16.         if (countRepeat[i] > 1) {
  17.             count++;
  18.         }
  19.     }
  20.  
  21.     return count;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment