Solution for Exercise 16-3

ex1603

#include <stdio.h>

typedef int stinky;

stinky main()
{
    stinky a = 2;

    printf("Everyone knows that ");
    printf("%d + %d = %d\n",a,a,a+a);
    return(0);
}

Notes

* You can see better examples of typedef by perusing the various header files that came with the compiler. typedef is frequently used to name specific variable types used by functions prototyped within the header file. The typedef allows the variable type to be consistent, but also to change if need by. It's similar to declaring a constant. So it's possible to change the typedef later without having to fish through piles of code: Simply alter the typedef in the header file to make the change.