ok, I get it then. why do the directions say "after the user enters the words, the program will determine which words would come first and last if the words were listed in dictionary order." doesn't that mean arrange them in alphabetical order? also, on the example they give of the output, the word "zebra" is 5 characters long. Another reason that I am confused because it says stop taking input after 4 characters. Here is the code I have to read 4 characters entered by the user so far.
Code:
#include <stdio.h>
#define N 20
int read_line(char str[], int n);
int main()
{
int i=4;
char word1[N], word2[N], word3[N], word4[N], word5[N], word6[N], word7[N];
printf ("Enter a word: ");
read_line(word1, i);
printf("%s\n", word1);
return 0;
}
int read_line (char str[], int n)
{
char ch;
int i = 0;
while ((ch = getchar()) != '\n')
if (i < n)
str[i++] = ch;
str[i] = '\0';
return i;
}
Is this what it means by only accepting four characters?