This is the handout from class, 5/6/97.  It illustrates the use of an array to keep track of the number of times each letter of the alphabet is used in a message.  Note that the array of integers should be initialized to be all zeroes before processing the text of the message.

#include <stdio.h>
int main(void)
   int letters[26];
   int counter;
   char ch;

   for (counter=0;counter<26;counter++)

   printf("Enter characters; enter a # to quit.\n");

   while ((ch=getchar()) != '#')
	{ if (ch >= 'a' && ch <= 'z')
	  else if (ch >= 'A' && ch <= 'Z')

    printf("Output: \n");
    for (counter=0;counter<26;counter++)
      { if (counter % 5 == 0)
	 printf("%c = %d   ",counter+65,letters[counter]);