| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 692 人关注过本帖
标题:大家好,我是c++新手,正在学习《数据结构》有些不懂的地方想请教一下
取消只看楼主 加入收藏
spzb11b
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-9-20
结帖率:100%
收藏
已结贴  问题点数:0 回复次数:2 
大家好,我是c++新手,正在学习《数据结构》有些不懂的地方想请教一下
创建一个顺序表,有a-z 26个小写字母。怎么填入数据?#define LIST_INIT_SIZE 26
#define LISTINCREMENT 1  //这里不知道对吗?
typedef struct{
    ElemType *elem;//这里用c++进行调试的时候,总是说ElemType没有定义,还有*elem前面没有加‘;’符号,很奇怪
    int lengtg;
    int listsize;
}SqList;


Status InitList_Sq(SqList &L)
L.elem=(ElemType*)malloc(LIST_INIT_SIZE*sizeof(ElemType));//分配空间
if(!L.elem) exit(OVERFLOW);
L.length=0;
L.listsize=LIST_INIT_SIZE;
return OK;
}//InitList_Sq

  然后用自创ListInsert_Sq(SqList &L,int i,ElemType)在任意位置插入一个字母


求高手请教
搜索更多相关主题的帖子: 空间 字母 return 
2011-09-20 18:57
spzb11b
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-9-20
收藏
得分:0 
回复 2楼 hellovfp
typedef char ElemType 是把ElemType定义为char型吗?
可是指针是char型的?
2011-09-22 13:14
spzb11b
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2011-9-20
收藏
得分:0 
c:\users\lin\desktop\123.c(21) : error C2143: syntax error : missing ')' before '&'
c:\users\lin\desktop\123.c(21) : error C2143: syntax error : missing '{' before '&'
c:\users\lin\desktop\123.c(21) : error C2059: syntax error : '&'
c:\users\lin\desktop\123.c(21) : error C2059: syntax error : ')'
c:\users\lin\desktop\123.c(30) : error C2143: syntax error : missing ')' before '&'
c:\users\lin\desktop\123.c(30) : error C2143: syntax error : missing '{' before '&'
c:\users\lin\desktop\123.c(30) : error C2059: syntax error : '&'
c:\users\lin\desktop\123.c(30) : error C2059: syntax error : ')'
c:\users\lin\desktop\123.c(38) : error C2143: syntax error : missing ')' before '&'
c:\users\lin\desktop\123.c(38) : error C2143: syntax error : missing '{' before '&'
c:\users\lin\desktop\123.c(38) : error C2059: syntax error : '&'
c:\users\lin\desktop\123.c(38) : error C2059: syntax error : ')'
c:\users\lin\desktop\123.c(54) : error C2143: syntax error : missing ')' before '&'
c:\users\lin\desktop\123.c(54) : error C2143: syntax error : missing '{' before '&'
c:\users\lin\desktop\123.c(54) : error C2059: syntax error : '&'
c:\users\lin\desktop\123.c(54) : error C2059: syntax error : ')'
c:\users\lin\desktop\123.c(72) : error C2143: syntax error : missing ')' before '&'
c:\users\lin\desktop\123.c(72) : error C2143: syntax error : missing '{' before '&'
c:\users\lin\desktop\123.c(72) : error C2059: syntax error : '&'
c:\users\lin\desktop\123.c(72) : error C2059: syntax error : ')'
c:\users\lin\desktop\123.c(90) : error C2143: syntax error : missing ')' before '&'
c:\users\lin\desktop\123.c(90) : error C2143: syntax error : missing '{' before '&'
c:\users\lin\desktop\123.c(90) : error C2059: syntax error : '&'
c:\users\lin\desktop\123.c(90) : error C2059: syntax error : ')'
2011-09-23 20:50
快速回复:大家好,我是c++新手,正在学习《数据结构》有些不懂的地方想请教一下
数据加载中...
 
   



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

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