
#include <stdio.h>

unsigned char *phrases[] = {                  // Array of pointers to strings
    "Short",                                  //  to display
    "Medium",
    "Very long"
    };                                        // End phrases[] table

#define MAX_LINES (sizeof(phrases) / sizeof(char *))

/* ///////////////////////////////////////////////////////////////////////// */
    
void put_phrase (                             // Displays the string pointed
    unsigned char *phrasePointer              //  to by 'phrasePointer'
    ) {

    while (*phrasePointer != 0) {             // For each character in string
        putchar(*phrasePointer++);            // Display the character
        }                                     // End 'for each character'
    putchar('\n');                            // Add newline for testing on PC
    }                                         // End put_phrase()

/* ///////////////////////////////////////////////////////////////////////// */
    
void main( void ) {                           // Exercises put_phrase()

    int i;                                    // Generic loop counter
    unsigned char phrase;                     // Index into phrases[] table

    for (i=0; i<5; i++) {                     // Do 5 times for testing on PC
        for (phrase = 0;                      // For each phrase in the table
             phrase < MAX_LINES;
             phrase++) {
            put_phrase(phrases[phrase]);      // Display the current phrase
            }                                 // End 'for each phrase'
        }                                     // End 'do 5 times'
    }                                         // End main()
