sizeof
sms> sizeof C sizeof (char) = 1 sizeof (double) = 8 sizeof (float) = 4 sizeof (int) = 4 sizeof (long) = 4 sizeof (long long) = 8 sizeof (short) = 2 sizeof (void *) = 4 sizeof (clock_t) = 4 sizeof (pid_t) = 4 sizeof (size_t) = 4 sizeof (ssize_t) = 4 sizeof (time_t) = 4 sms>
The printsize() macro ensures that the program output is consistent, that the data type name and size are displayed consistently. The use of # within macros is described in in section A12.3 of Kernighan & Ritchie.
You can modify this code to display the size of your own data structures. Simply include the appropriate header files and add your own printsize() call.