makrusak

alphabet

Dec 10th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. void alphabet_make(const char * codeword, char * a) {
  2.   bool was[27];
  3.   for (int i=0;i<27;i++) was[i] = 0;
  4.   while (*codeword!='\0') {
  5.     was[*codeword-'a'] = 1;
  6.     *a = *codeword;
  7.     codeword++;
  8.     a++;
  9.   }
  10.   for (char i='a';i<='z';i++) {
  11.     if (!was[i-'a']) {
  12.       *a = i;
  13.       a++;
  14.     }
  15.   }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment