为什么我顺序表结果得不到理想结果?
```c
void Testseqlist1()
{
s1 s1;
seqlistInit(&s1);
seqlistpushback(&s1, 1);
seqlistpushback(&s1, 2);
seqlistpushback(&s1, 3);
seqlistprint(&s1);
}
int main()
{
Testseqlist1();
return 0;
}
#pragma once
#include<stdio.h>
#include<stdlib.h>
typedef int sldatatype;
typedef struct seqlist
{
sldatatype* a;
sldatatype size;
int capacity;//数组实际存储空间
}s1;
//接口函数
void seqlistprint(s1*ps);
void seqlistInit(s1* ps);//初始化
void seqlistpushback(s1*ps, sldatatype x);//尾插
void seqlistpopback(s1*ps, sldatatype x);
```c
#include "seqlist.h"
void seqlistprint(s1*ps)
{
for (int i = 0; i < ps->size; i++)
{
printf("%d,ps->a[i]");
}
printf("\n");
}
void seqlistInit(s1* ps)
{
ps->a = NULL;
ps->size = ps->capacity = 0;
}
void seqlistpushback(s1* ps, sldatatype x)
{
if (ps->size == ps->capacity)
{
//如果没有空间外面就扩容
int newcapacity = ps->capacity == 0 ? 4 : ps->capacity * 2;
sldatatype*tmp = (sldatatype*)realloc(ps->a, newcapacity*sizeof(sldatatype));
if (tmp == NULL)
{
printf("realloc fail");
exit(-1);
}
ps->a = tmp;
ps->capacity = newcapacity;
}
ps->a[ps->size] = x;
ps->size++;
}
void seqlistpopback(s1* ps);
```我想要的结果应该是1,2,3。为什么最后不是
```