program must let user input words
stops when length of word is 4 characters
keeps track of length of all words, prints out shortest and longest words
(part of the instructions say that the program will determine which words would come first and last if were listed in dictionary order - though I don't understand what that has to do with length of word)

Can someone get me on the right path to the order of the functions called, and maybe help with the code that checks length and stores smallest so far in the smaller_word string and stores the longest word so far in the longest_word string?????

Code:


#include <stdio.h>
#include <string.h>
 
#define WORD_LEN 20
 
read_line(char str[], int );                  /*  function prototype   */
size_t strlen(const char *);                /*  function prototype   */
 
main()
 
{  
    char word[WORD_LEN + 1];            /*  array/string for words input by user  */
    char *ptr;                                    /*  char pointer for func strlen      */
    char smallest_word[WORD_LEN +1];  /*  smallest word in length            */
    char largest_word[WORD_LEN +1];   /*  largest word in length            */
    char fword[WORD_LEN +1];
    char lword[WORD_LEN +1];    
    int n;                                          /*  counter variable */
 
    
while (strlen(word) != 4)         /*   this is not setup right, not sure if while or for loop best */
      {
          printf("Enter word: \t\n");
          read_line(str[], strlen(word));  /*  call function to read word char by char */
          puts (word);                         /*  print word              */
          strlen(word);                        /*  call function to find string length  */
                               /*  loop to keep track of smallest and longest word here */
       
      }
    
     if (strlen(word) == 4)         /*  somewhere this fits in to stop if 4 letter word is input */ 
         break;



 
   printf("First word alphabetically :  %s\n", fword);     /*   printing */
   printf("Last word alphabetically :  %s\n",  lword);     /*  all the   */
   printf("Smallest word :  %s\n", smallest_word);        /*  final      */
   printf("Longest word :   %s\n", longest_word);        /*  output   */
 
return 0;
}
 
read_line(char str[], int n)         /*  function to read word input   */
                                                 /*    character by  character      */
{
    char ch;
    int i=0; 
    while ((ch = getchar() != '\n')
         if (i < n )
              str[i++] = ch;
         str[i] = '\0';                     /*  terminates string  */
         return i;                          /*  returns # of characters  */
}
 
size_t strlen(const char *s)       /*  function to keep track of length */
{                                               /*  of each word input                  */
   size_t n=0;
   while (*s++)
      n++:
   return n;                            /*  returns length of string   */           
}