SqList &L与&L?
这是实现顺序表的初始化c程序:
#include "stdio.h"
#include "stdlib.h"
#define OVERFLOW 0
#define OK 1
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct {
int *elem;
int length;
int listsize;
}SqList;
int InitList_Sq(SqList *L);
int main()
{
SqList L;
InitList_Sq(SqList &L);
system("pause");
return 0;
};
int InitList_Sq(SqList *L)
{
L->elem = (int *)malloc(LIST_INIT_SIZE * sizeof(int));
if(!L->elem) exit(OVERFLOW);
L->length = 0;
L->listsize = LIST_INIT_SIZE;
return OK;
}
其中 InitList_Sq(SqList &L); 出错:
--------------------Configuration: 线性表的顺序表示 - Win32 Debug--------------------
Compiling...
线性表的顺序表示.cpp
F:\MyProject\线性表的顺序表示\线性表的顺序表示.cpp(22) : error C2275: 'SqList' : illegal use of this type as an expression
F:\MyProject\线性表的顺序表示\线性表的顺序表示.cpp(14) : see declaration of 'SqList'
Error executing cl.exe.
线性表的顺序表示.obj - 1 error(s), 0 warning(s)
如果把 InitList_Sq(SqList &L); 改为 InitList_Sq(&L); 后编译就不会出错,这是为什么呢?
#include "stdio.h"
#include "stdlib.h"
#define OVERFLOW 0
#define OK 1
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef struct {
int *elem;
int length;
int listsize;
}SqList;
int InitList_Sq(SqList *L);
int main()
{
SqList L;
InitList_Sq(SqList &L);
system("pause");
return 0;
};
int InitList_Sq(SqList *L)
{
L->elem = (int *)malloc(LIST_INIT_SIZE * sizeof(int));
if(!L->elem) exit(OVERFLOW);
L->length = 0;
L->listsize = LIST_INIT_SIZE;
return OK;
}
其中 InitList_Sq(SqList &L); 出错:
--------------------Configuration: 线性表的顺序表示 - Win32 Debug--------------------
Compiling...
线性表的顺序表示.cpp
F:\MyProject\线性表的顺序表示\线性表的顺序表示.cpp(22) : error C2275: 'SqList' : illegal use of this type as an expression
F:\MyProject\线性表的顺序表示\线性表的顺序表示.cpp(14) : see declaration of 'SqList'
Error executing cl.exe.
线性表的顺序表示.obj - 1 error(s), 0 warning(s)
如果把 InitList_Sq(SqList &L); 改为 InitList_Sq(&L); 后编译就不会出错,这是为什么呢?
...全文
相关推荐
SqList.cpp
编程实现顺序表的基本操作函数。 (1) void InitList(SqList &L, int n) //建立一个表长为n的顺序表 (2) void ListInsert(SqList &L, int i, ElemType e) //在顺序表中第i个位置插入元素函数e (3) void ListDelete(SqList&L, int i, ElemType &e) //删除顺序表L的第i个数据元素,并用e返回其值。 (4) void PrintList(SqList L) // 输出顺序表 (5) int Locate(SqList L, ElemType e) //若顺序表L中存在数据元素e,则返回e在顺序表L中第一次出现的位序;否则返回0. (6) int ListLength(SqList L) //求顺序表L的表长
数据结构实现下列函数:void InsertSort(SqList &L);
试以L.r[k+1]作为监视哨改写教材10.2.1节 中给出的直接插入排序算法。其中,L.r[1..k]为待排 序记录且k<MAXSIZE。 实现下列函数: void InsertSort(SqList &L);
SQList数据库之基础
SQList数据库
数据结构SqList (c语言实现代码)
数据结构SqList (c语言实现代码)
SQList 数据库
在Mac上打开db文件,有些app中需要包含一些db文件,用于存储资源,有时候,我们想看看其中的内容,但是这个只有专业的吧软件才能打开


