typedef union { long i;int k[5];char c; }DATE; struct date {
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/06 04:25:13
typedef union { long i;int k[5];char c; }DATE; struct date { int cat;DATE cow;double dog; }too;
typedef union
{
long i;int k[5];char c;
}DATE;
struct date
{
int cat;DATE cow;double dog;
}too;
DATE max;
main()
{
printf("%d",sizeof(struct date)+sizeof(max));
}
求详细解答
typedef union
{
long i;int k[5];char c;
}DATE;
struct date
{
int cat;DATE cow;double dog;
}too;
DATE max;
main()
{
printf("%d",sizeof(struct date)+sizeof(max));
}
求详细解答
sizeof(max)是求max类型的大小,max的类型是union结构,在union结构中所有变量共用同一个空间,在这个union中,i占4 个字节,k[5] 占20个字节,c占1个字节,因为是共用同一个空间,所以union 的大小按最大的变量k[5]来算,占20个字节.
在struct date结构中,cat占4个字节,cow占20个字节,dog占8个字节,合起来就是32个字节.
sizeof(struct date)+sizeof(max) 等于20+32 等于52
在struct date结构中,cat占4个字节,cow占20个字节,dog占8个字节,合起来就是32个字节.
sizeof(struct date)+sizeof(max) 等于20+32 等于52
typedef union { long i;int k[5];char c; }DATE; struct date {
请问这个结构体所占的空间大小是___字节.typedef struct { int a,char b,short c,s
#include struct student { long num; char name[10]; int age;
struct{int i;char c;float a}test;则sizeof(test)的值是
main() { union { char i[2]; int k; } r; r.i[0]=2; r.i[1]=0;
void main() {union { int k; char i[2]; }*s,a; s=&a; s->i[0]=
typedef struct node { int data; struct node *next; }Node,*Li
typedef struct node { int data; struct node *next; } NODE,*n
typedef int ElemType; struct Lnode{ ElemType data; struct Ln
(1/2)已知有如下声明,则sizeof(test)的值是_____?struct {int i; char c; fl
typedef struct
一个C语言找错题#includemain(){struct{long number;char name[10];char