It's simple!!!!!

Code:
   struct stud
   {
           char ch;
           int    i;
           char ch1;
    };
Total size of this structure will be 12 byte on 32-bit machine. Because first character's size will be only 1 Byte but due to memory alignment( Algorithm to fast access memory by CPU) , 3 byte will as structure Hole. Because next data is integer which size is 4 Byte.

To avoid this user have to write structure very carefully.

Code:
Struct stud
{
   char ch;
   char ch1;
   int  i;
} ;
Now It's size will be 8 byte. First two character will come to on Four Byte cycle where actually size of these two character is 2 byte. But it is better that 1st structure.
This things happen only due to easily and fast access memory by CPU.

Last edited by shabbir; 9Jan2008 at 14:04.. Reason: Code block