/* * functions for use with programs that count alphabetic characters */ #ifndef ALPHABET_H /* just in case we forget and #include this twice */ #define ALPHABET_H /* * function to build "alphabet" -- all characters for which islower() * is true. * * also does some simple "sanity checking" that there are not any * such characters that are negative (and exits the program if so). * * parameter "alphachars" must be array of size at least SCHAR_MAX+2. */ void build_alphabet(char alphachars[]); /* * function to get index of character in alphabet. * * returns index of tolower(ch) in alphabet, or -1 if not found. */ int char_to_index(char * alphabet, char ch); /* * function to get character from alphabet. * * returns character at alphabet[index]. */ char index_to_char(char * alphabet, int index); #endif /* #ifndef ALPHABET_H */