Solution for Exercise 19-9

ex1909

#include <stdio.h>

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

    pa = alphabet;            /* initialize pointer */

    /* fill the array */
    for(x=0;x<26;x++)
    {
        *pa++=x+'A';
    }

    pa = alphabet;            /* re-initialize pointer */

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

    return(0);
}

Output

ABCDEFGHIJKLMNOPQRSTUVWXYZ

Notes

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