I need the coding for the following question in C:
Read and print all the consonants from a file (no duplicates). Assume the file is a .txt file. The consonants are then to be sorted in alphabetical order.

The solution is pretty easy if you think about it. Every character in the English alphabet, and other characters too, have a numeric value between 0 and 255. To see what they are just google for "ascii chart". Given that, create an int array of 255 elements and initialize all of them to 0. Then read the file one character at a time, using the character as the index into the array. For example

int array[255] = {0};


In the above the 65th element of the array will be incremented because the decimal value for the letter 'A' is 65. Instead of hardcoding the letter 'A' you would use the variable that you used to read the character in the file.

When you are done reading the file, all the consonants will already be in sorted order, so all you have to do is print them out. Loop through the array looking for array elements that are greater than 0 and are consonants.

Program done.