怎么搞的??

hineil 2001-06-17 08:06:00
#define list_init_size 100
#define listncrement 10
#include <stdlib.h>
#include <malloc.h>

struct sqlist
{
int *elem;
int length;
int listsize;
};

void initlist_sq(struct sqlist &l)
{
l.elem=(int *)malloc(list_init_size* sizeof(int));
if (!l.elem)
return 1;
l.length=0;
l.listsize=list_init_size;
return 0;
}


...全文
99 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
hineil 2001-06-19
  • 打赏
  • 举报
回复
to seesi:谢谢你,你的我CL通过了,果然和我想的差不多,用指针来做。

to smartboyme :不知兄弟你用的是何CL,我用VC,还是不行呀。我也知道VOID的函数里
不应该有RETRUN的,不过这也是理论上,实际中是不大会报错的,至少M$的东西不会报。
smartboyme 2001-06-19
  • 打赏
  • 举报
回复
我的意见。
函数如果为void型的,是不是不应该有返回值啊!
我试过了,这样没有问题啊!
如果你的有问题,可能是你其它部分引起的。

//
#define list_init_size 100
#define listncrement 10
#include <stdlib.h>
#include <malloc.h>

struct sqlist
{
int *elem;
int length;
int listsize;
};

int initlist_sq(struct sqlist &l)
{
l.elem=(int *)malloc(list_init_size* sizeof(int));
if (!l.elem)
return 1;

l.length=0;
l.listsize=list_init_size;
return 0;
}
void main(void)
{
struct sqlist ql;
initlist_sq(ql);
}
seesi 2001-06-19
  • 打赏
  • 举报
回复
typedef struct sqlist
{
int *elem;
int length;
int listsize;
}*PSQLIST;

void initlist_sq(PSQLIST l)
{
l->elem=(int *)malloc(list_init_size* sizeof(int));
if (!l->elem)
return ;
l->length=0;
l->listsize=list_init_size;
return ;
}
hineil 2001-06-19
  • 打赏
  • 举报
回复
不行。加BOOL也好,加INT也好,去RETURN也好,都是四个错:

error C2143: syntax error : missing ')' before '&'
error C2143: syntax error : missing '{' before '&'
error C2059: syntax error : '&'
error C2059: syntax error : ')'
liufeng 2001-06-19
  • 打赏
  • 举报
回复
把return 0去掉就ok了。
colorknight 2001-06-19
  • 打赏
  • 举报
回复
你的函数是VOID类型,只需要RETURN;就行了吧!
floodzhu 2001-06-19
  • 打赏
  • 举报
回复
你的函数返回类型应该是bool / int 吧,别的就没有错了.
hineil 2001-06-19
  • 打赏
  • 举报
回复
就没有人知道吗?
hineil 2001-06-17
  • 打赏
  • 举报
回复
CL后有错呀~~
大家帮我看看吧。

111222 2001-06-17
  • 打赏
  • 举报
回复
hineil你真逗~:)
huangbeyond 2001-06-17
  • 打赏
  • 举报
回复
什么问题?

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

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