[LCP]struct & union

shahnavaz shan at ways.com
Mon Feb 4 15:35:10 UTC 2002


hi,
	Can someone tell me why the sizeof returns 4 in the main function.Even if i 
use int in place of float it returns 4.

TIA
shan


#include<stdio.h>
struct s{
	float data;
};
struct c{
	float c;
};	
typedef union {
	struct s ss;
	struct c cc;
}Union;

int main(void)
{
	Union u;
	printf("Size of Union is  %d\n",sizeof(u));
	return 0;
}



More information about the linuxCprogramming mailing list