Solution for Exercise 14-4

ex1404

#include <stdio.h>

int main()
{
    struct president
    {
        char name[40];
        int year;
    } first = {
        "George Washington",
        1789
    };

    printf("The first president was %s\n",first.name);
    printf("He was inaugurated in %d\n",first.year);

    return(0);
}

Output

The first president was George Washington
He was inaugurated in 1789

Notes

* To make this change from Exercise 14-3, join Lines 9 and 10 and delete from the semicolon (old Line 9) to the word first.