| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 375 人关注过本帖
标题:两道难题请教各位大大
只看楼主 加入收藏
zhoujingchen
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-3-6
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
两道难题请教各位大大
遇到两道难题,实在是不懂,请教各位,除了答案以外,烦请各位高手具体讲讲过程,真是一点也没懂。
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;
}
搜索更多相关主题的帖子: 难题 
2010-03-06 18:28
hanzhenddd
Rank: 5Rank: 5
等 级:职业侠客
帖 子:90
专家分:361
注 册:2010-3-4
收藏
得分:20 
偷懒?   不在 linux下 自己算算吧  加加就出来了!!~

链表操作看书去吧,。。别人帮不了你,,自己写才是真理 哪里不会可以问。。但不是这样。。

函数 变量 命名 尽量不要用驼峰命名法。。。做C的程序员总还是要有些规矩的!~
2010-03-06 19:27
快速回复:两道难题请教各位大大
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017459 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved