#include<stdio.h>
#include "SequenceList.h"
void print(ElemType *e)
{
printf("%d\n", *e);
}
int main()
{
int ret, i;
SqList list;
ret = InitList(&list);
if (FAILURE == ret)
{
printf("INIT FAILURE!\n");
}
else
{
printf("INIT SUCCESS!\n");
}
ret = ListEmpty(&list);
if (TRUE == ret)
{
printf("List is empty!\n");
}
else
{
printf("List is not empty");
}
for (i = 1; i <= 5; i++)
{
ret = ListInsert(&list, i, i);
if (FAILURE == ret)
{
printf("INSERT %d FAILURE!\n", i);
}
else
{
printf("INSERT %d SUCCESS!\n", i);
}
}
ret = ListTraverse(&list, print);
if (FAILURE == ret)
{
printf("TRAVERSE FAILURE!\n");
}
else
{
printf("TRAVERSS SUCCESS!\n");
}
return 0;
}
#include "SequenceList.h"
void print(ElemType *e)
{
printf("%d\n", *e);
}
int main()
{
int ret, i;
SqList list;
ret = InitList(&list);
if (FAILURE == ret)
{
printf("INIT FAILURE!\n");
}
else
{
printf("INIT SUCCESS!\n");
}
ret = ListEmpty(&list);
if (TRUE == ret)
{
printf("List is empty!\n");
}
else
{
printf("List is not empty");
}
for (i = 1; i <= 5; i++)
{
ret = ListInsert(&list, i, i);
if (FAILURE == ret)
{
printf("INSERT %d FAILURE!\n", i);
}
else
{
printf("INSERT %d SUCCESS!\n", i);
}
}
ret = ListTraverse(&list, print);
if (FAILURE == ret)
{
printf("TRAVERSE FAILURE!\n");
}
else
{
printf("TRAVERSS SUCCESS!\n");
}
return 0;
}