Strange Result on Struct
Posted: Fri Aug 18, 2006 7:50 am
My friend of mine ask me about this code and I was unable to answer it why. Here's the code:
It supposed to be 6 bytes, didn't it? But when my friend compiled it with GCC and VC++ 6, he got 8 bytes? Why?
Thanx in advance
Code: Select all
#include<stdio.h>
struct da{
int a;
short b;
}asd;
void main(){
printf("%d",sizeof(asd));
}
Thanx in advance
