Solution for Exercise 19-9

ex1909

#include <stdio.h>

int main()
{
    char alphabet[27];
    int x;
    char *pa;

    pa = alphabet;      /* initialize pointer */

/* Fill array */
    for(x=0;x<27;x++)
    {
        *pa++=x+'A';
    }

    pa = alphabet;

/* Display array */
    for(x=0;x<26;x++)
    {
        putchar(*pa++);
    }
    putchar('\n');

    return(0);
}

Notes

* Line 22 combines two statements into one. Here are the original two statements:

You're effectively pulling the second statement up into the first, inside the putchar() function.