写的不标准,改了改勉强过了。。
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 20
#define OK 1
#define ERROR 0
#define TRUE 1
#define FALS 0
typedef  int Status;
typedef int ElemType;
typedef struct
    {
        ElemType data[MAXSIZE];
        int length;
    }SqList;
Status GetElem(SqList L,int i,ElemType *e);
int main()
{
    SqList l;
    l.length=10;
    int j,e;
    for(j=0;j<l.length;j++)
    {
        l.data[j]=j+1;
    }
    printf("%d ",GetElem(l,3,&e));
    printf("%d\n",e);
    return 0;
}
Status GetElem(SqList L,int i,ElemType *e)
{
    if(i<1||i>L.length||L.length==0)
    {
        return ERROR;
    }
    *e=L.data[i-1];
    return OK;
}
原文:http://www.cnblogs.com/LuRenJiang/p/6291112.html