菜鸟向大神求助

liunian023 2013-12-07 04:00:35
写了一个简易的表顺序存储结构插入函数如下:
#include<stdio.h>
#define MAXSIZE 100
typedef int ElemType;
typedef struct SeqList
{
ElemType elem[MAXSIZE];
int next;
}SeqList;
typedef SeqList *pSeqList;

void listInsert(pSeqList s,int p,ElemType e)
{
if(p<0||p>=MAXSIZE)
printf("越界!");
int i;
for(i=s->next-1;i>=p;i--)
s->elem[i+1]=s->elem[i];
s->elem[p]=e;
s->next++;
}

编译时出现: syntax error : missing ';' before 'type'';
'i' : undeclared identifier;
但注销if()和printf那两行却能通过编译,请各位大神指教为啥呢?
...全文
77 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liunian023 2013-12-07
  • 打赏
  • 举报
回复
换了台电脑同样编译器可以通过编译,谢啦!
buyong 2013-12-07
  • 打赏
  • 举报
回复
是不是分号打成中文了
yuwujian 2013-12-07
  • 打赏
  • 举报
回复
拷贝你的代码编译完,没有错误。。。
derekrose 2013-12-07
  • 打赏
  • 举报
回复
什么编译器。

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧