#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
#include<stdlib.h>
#include<string.h>

#define MAX_SIZE 5
typedef int DataType;

typedef struct SeqList
{
    size_t size;
    DataType array[MAX_SIZE];
}SeqList;

//void InitSeqList(SeqList* pSeq)
//{
//    assert(pSeq);
//    memset(pSeq->size, 0, sizeof(DataType)*MAX_SIZE);
//    pSeq->size = 0;
//}

//void PushBack(SeqList* pSeq, DataType x)
//{
//    assert(pSeq);
//    if (pSeq->size >= MAX_SIZE)
//    {
//        printf("顺序表已满,无法插入!");
//        return;
//    }
//    pSeq->array[pSeq->size++] = x;
//    pSeq->size++;
//}

//void PopBack(SeqList* pSeq)
//{
//    assert(pSeq);
//    if (pSeq->size <= 0)
//    {
//        printf("顺序表已空,无法删除!");
//        return;
//    }
//    pSeq->size--;
//}

//void PushFront(SeqList* pSeq, DataType x)
//{
//    assert(pSeq);
//    int begin = pSeq->size - 1;
//    int i = 0;
//    if (pSeq->size >= MAX_SIZE)
//    {
//        printf("顺序表已满,无法插入!");
//        return;
//    }
//    for (i = begin; i >= 0; i--)
//    {
//        pSeq->array[begin + 1] = pSeq->array[begin];
//    }
//    pSeq->array[0] = x;
//    pSeq->size++;
//}

//
//void PopFront(SeqList* pSeq)
//{
//    assert(pSeq);
//    int begin = 1;
//    if (pSeq->size <= 0)
//    {
//        printf("顺序表已空,无法删除!");
//        return;
//    }
//    for (begin = 1; begin < pSeq->size; begin ++)
//    {
//        pSeq->array[begin -1] = pSeq->array[begin];
//    }
//    pSeq->size--;
//}


//void Insert(SeqList* pSeq, size_t pos, DataType x)
//{
//    assert(pSeq);
//    int begin = pSeq->size;
//    if (pSeq->size >= MAX_SIZE)
//    {
//        printf("顺序表已满,无法插入!");
//        return 0;
//    }
//    for (; begin > pos;begin--)
//    {
//        pSeq->array[begin] = pSeq->array[begin-1];
//    }
//    pSeq->array[pos] = x;
//    pSeq->size++;
//}

//int Find(SeqList* pSeq,DataType x)
//{
//    int i = 0;
//    for (; i < pSeq->size; i++)
//    {
//        if (pSeq->array[i] == x)
//        {
//            return i;
//        }
//    }
//    return -1;
//}

//void Erase(SeqList* pSeq, size_t pos)
//{
//    assert(pSeq);
//    int begin = 0;
//    if (pSeq->size <= 0)
//    {
//        printf("顺序表已空,无法删除!");
//        return;
//    }
//    assert(pos < pSeq->size);
//
//    for (; begin < pSeq->size; ++begin)
//    {
//        pSeq->array[begin - 1] = pSeq->array[begin];
//    }
//    pSeq->size--;
//}

//int Remove(SeqList* pSeq, DataType x)
//{
//    int pos;
//    assert(pSeq);
//
//    pos = Find(pSeq, 0, x);
//    if (pos != -1)
//    {
//        Erase(pSeq, pos);
//    }

//    return pos;
//}

//void RemoveAll(SeqList* pSeq, DataType x)
//{
//    int count = 0;
//    int begin = 0;
//    assert(pSeq);
//
//    for (; begin < pSeq->size; ++begin)
//    {
//        if (pSeq->array[begin] == x)
//        {
//            ++count;
//        }
//        else
//        {
//            pSeq->array[begin - count] = pSeq->array[begin];
//        }
//    }
//
//    pSeq->size -= count;
//}

void PrintSeqList(SeqList* pSeq)
{
    int i = 0;
    assert(pSeq);

    for (; i < pSeq->size; ++i)
    {
        printf("%d ", pSeq->array[i]);
    }

    printf("\n");
}