Solution for Exercise 18-5

ex1805

#include <stdio.h>

int main()
{
    struct robot {
        int alive;
        char name[5];
        int xpos;
        int ypos;
        int strength;
    };

    printf("The evil robot struct size is %u\n",
            sizeof(struct robot));
    return(0);
}

Notes

* For a Macintosh, and some other Unix variants, change the conversion character used in printf() at Line 13 to %ld.