It's 24 bytes due to padding.
Most compilers pad data to a multiple of its size.
So, a 4-byte int is padded to a multiple of 4 bytes.
A 8-byte double is padded to a multiple of 8 bytes.
For your structure, this means:
struct struct_type{
int i; // offset 0 (0*4)
char ch; // offset 4 (4*1)
char padding1[3];
int *p; // offset 8 (2*4)
char padding1[4];
double d; // offset 16 (2*8)
}s;
You can optimize your struct like that:
struct struct_type{
double d;
int i;
int *p;
char ch;
}s;
sizeof(s)==17 on most compilers (20 on some others)