close
#include <stdio.h>
union udata {
int x;
long y;
double z;
char *a;
};
struct sdata {
int x;
long y;
double z;
char *a;
};
int main(void)
{
printf("%d\n", sizeof(union udata));//union為共用memory,顯示:8
printf("%d\n", sizeof(struct sdata));//struct為獨立memory,顯示:24
return 0;
}
全站熱搜