| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 950 人关注过本帖
标题:初学者 程序中的错误 高手帮忙看下
取消只看楼主 加入收藏
liujiesmart
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-6-27
收藏
 问题点数:0 回复次数:0 
初学者 程序中的错误 高手帮忙看下
#include "stdio.h"
#include "stdlib.h"
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
#define OK 1
#define ERROR 0
#define OVERFLOW -2
typedef int Status;
typedef int Elemtype;
typedef struct
{
        Elemtype *elem;
        int length;
        int listsize;

}sqlist;

Status Inslist(sqlist *L,int i)
{int m,*p,*q;
if(i>L.length||i<1)
return 0;
printf("请输入想要插入的元素:");
scanf("%d\n ",&m);
q=&(L.elem[i-1]);
for(p=&(L.elem[L.length-1]);p>=q;--p)
*(p+1)=*p;
*q=m;
++L.length;
printf("新表的元:");
for(m=0;m<L.length;++m)
printf("%d  ",L.elem[m]);
printf("表长为:%d,容量为:%d",L.length,L.listsize);
return 1;
}
void main()
{int i,m,n;
sqlist *L;
L.elem=(Elemtype*)malloc(LIST_INIT_SIZE*sizeof(Elemtype));
if(!L.elem)exit(OVERFLOW);
L.length=0;
L.listsize=LIST_INIT_SIZE;
printf("请输入元素个数:");
scanf("%d",&m);
if(m>L.listsize)
return 0;
L.length=m;
printf("请输入元素:\n");
for(i=1;i<=m;++i)
{scanf("%d ",&L.elem);
++L.elem;
}
printf("请输入要插入的元素位置:");
scanf("%d",&m);
Inslist(L,m);
}
我初步编的就有许多同样的错误



Text1.c
C:\Documents and Settings\liujiesmart\桌面\Text1.c(20) : error C2231: '.length' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(24) : error C2231: '.elem' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(25) : error C2231: '.elem' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(25) : error C2231: '.length' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(28) : error C2231: '.length' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(30) : error C2231: '.length' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(31) : error C2231: '.elem' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(32) : error C2231: '.length' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(32) : error C2231: '.listsize' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(38) : error C2231: '.elem' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(39) : error C2231: '.elem' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(40) : error C2231: '.length' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(41) : error C2231: '.listsize' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(44) : error C2231: '.listsize' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(45) : warning C4098: 'main' : 'void' function returning a value
C:\Documents and Settings\liujiesmart\桌面\Text1.c(46) : error C2231: '.length' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(49) : error C2231: '.elem' : left operand points to 'struct', use '->'
C:\Documents and Settings\liujiesmart\桌面\Text1.c(50) : error C2231: '.elem' : left operand points to 'struct', use '->'
执行 cl.exe 时出错.
搜索更多相关主题的帖子: int define 
2008-06-27 22:29
快速回复:初学者 程序中的错误 高手帮忙看下
数据加载中...
 
   



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

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