两道难题请教各位大大
遇到两道难题,实在是不懂,请教各位,除了答案以外,烦请各位高手具体讲讲过程,真是一点也没懂。1 请给出下面的数据结构的sizeof()(32位编译环境)
Typedef’strucrt{
Unsigned short a:4;
Unsigned short b:12;
Unsigned short c:2;
Unsigned short d:10;
Unsigned short e:4;
}t_structl;
Tvpedef struct{
Unsigned int a:4;
Unsigned int b:12;
Unsigned int c:2;
Unsigned int d:10;
Unsigned int e:4;
}t_struct2;
Typedef struct{
Unsigned int a;
Unsigned short b;
Unsigned int c;
Unsigned ishort d;
Unsigned int e;
}t_struct3;
Typedef’strucrt{
Unsigned int a;
Unsigned int b;
Unsigned short c;
Unsigned short d;
Unsigned int e;
}t_struct4;
Typedf strut{
T_structl s1;
T_structl s2;
T_structl s3;
T_structl s4;
}t_common;
2 双链表结构定义如下
typedf struct DLLIST{
int info;
Struct DLLIST*Prev;
Struct DLLIST*Nrev;
}DLLIST;
(1) 完成链表的创建(5Points)
DLLIST*DLCreat(int newinfo)
{
DLLIST*NewItem;
NewItem = Malloc(sizeof(NewIten));
If(NewItem!=NULL)
{
}
Return NewItem;
}
(2) 完成双链表的前插操作, 成功return DL_OK
失败return DL_ERROR (10Points)
int DLLInsertBefore(DLLIST*ExistingItem,DLLIST*NewItem)
{
int Result =DL_OK;/*DL_OK and DL_ERROR are defined in other file*/
if(Existingltem !=NULL&& Newltem !NULL)
{
}
else
{
Result =DL_ERROR;
}
Return Result;
}