Reversing an array and printing it out
I've found a "problem" online. Text goes:
Quote:
Write C program that enables input of number n, (1 ≤ n ≤ 7) which stands for day of the week. If entered number does not correspond to any day, print error message of choice and ask user to repeat input of number n. For initialization of names of days use array of pointers. Print day user inputted. Use only pointer notation. Check which day has most consonants and print that day reversed.
I had no problem with first part, but the last is one that bothers me. If I initialize an array of 7 elements (days) how do I check for number of consonants? My idea was to make separate array of consonants with 5 elements and do something with it. But, I'm stuck. Any help is appreciated. So far, without first part, I have this:
Code:
for (i = 0; i < 7; i++) {
counter = 0;
for (j = 0; (j < 20) || *(vowels + j) != '\0'; j++) {
if (*(*(days + i) + j) != *(vowels + j))
counter++;
if (counter > temp) {
temp = counter;
index = i;
}
}
}