改了好几遍都是改不对,在元素的按值查找的步骤那一直报错,确实有点懵,各位能人能不能教教我🆘真的不会啊,虽然是基础确实不会
代码能编译通过?
#include <stdio.h>
#define MaxSize 50
typedef int status;
typedef int ElemType;
typedef struct {
ElemType data[MaxSize];
int length;
}SqList,*PSqList; //SeqList , *PSqeList
int LocateElem(SqList& L, ElemType e)//在顺序表L中查找值为e的数据元素
{
int i;
for (i = 0; i < L.length; i++)
{
if (L.data[i] == e) //L.elem[i] == e
return i + 1;
}
if (i == L.length)
return 0;
}