Say you had a struct like this:

typedef struct{
    int i;
    short s;
    unsigned char pad[2];
} test_t;

What would be the point of adding the member pad as doesn't the compiler automatically do things like that? I saw a struct like this looking in some source code and was wondering what it did.

compilers will leave holes in the structure if its data members are not aligned properly. One reason for adding padding members is to insure the structure compiles the same with every compiler and operating system and to make transmission across tcp/ip more reliable.