/* * implementations of functions in alphabet.h */ #include #include #include #include #include void build_alphabet(char alphachars[]) { /* * "sanity check" that no lowercase characters are negative ints */ for (int ch = SCHAR_MIN; ch < 0; ++ch) { if (islower(ch)) { printf("program failed sanity check for char %d\n", ch); exit(1); } } int count = 0; for (int ch = 0; ch <= SCHAR_MAX; ++ch) { if (islower(ch)) { alphachars[count++] = ch; } } alphachars[count] = '\0'; } int char_to_index(char * alphabet, char ch) { /* FIXME your code goes here */ /* if you use strchr you won't need a loop */ return -1; /* FIXME temporary so compiler doesn't complain */ } char index_to_char(char * alphabet, int index) { /* FIXME your code goes here */ return ' '; /* FIXME temporary so compiler doesn't complain */ }