Hello,
Here I have small program. When I print the size of individual elements of structe, I get correct answer. But when I print the size of entire structure it gives 10 instead of 8.
This code developed using VC6.0
Please let me know..
Juganoo
typedef unsigned char BYTE ; /* 8-bit data */
typedef unsigned short INT16; /* 16 bit Data*/
typedef unsigned int WORD ; /* 32-bit data */
typedef double DWORD ; /* 64-bit data */
typedef struct MacroElement
{
BYTE bElementID;
BYTE bType;
BYTE bPointer;
INT16 iCount;
INT16 iIndex;
BYTE bStatus;
};
struct MacroElement MacroElement;
main()
{
/*printf("Size of BYTE %d\n",sizeof(BYTE));
printf("Size of INT16 %d\n",sizeof(INT16));
printf("Size of WORD %d\n",sizeof(WORD));
printf("Size of DWORD %d\n",sizeof(DWORD));*/
printf("Size of BYTE %d\n",sizeof(MacroElement.bElementID));
printf("Size of INT16 %d\n",sizeof(MacroElement.bType));
printf("Size of WORD %d\n",sizeof(MacroElement.bPointer));
printf("Size of DWORD %d\n",sizeof(MacroElement.iCount));
printf("Size of DWORD %d\n",sizeof(MacroElement.iIndex));
printf("Size of DWORD %d\n",sizeof(MacroElement.bStatus));
printf("Size of MacroElement %d\n",sizeof(struct MacroElement));
}