高分请教C语言问题

来源:百度知道 编辑:UC知道 时间:2024/05/18 16:38:16
已知一个线性表,元素按值非递减有序排列,以链式存储编写一个算法删除表中多余的值相同的元素。
请对命令解释一下意思。
请按要求写出这个能在C语言环境中实现的程序
键盘输入10个非递减有序元素,然后输出删除相同元素以后的结果!~

这是我做的,你参考一下吧。
/*已知一个线性表,元素按值非递减有序排列,
以链式存储编写一个算法删除表中多余的值相同的元素。*/
#include "stdio.h"
#include "malloc.h"
#define FALSE 0
#define TRUE 1
typedef int KeyType;

typedef struct ElemType
{
int key;
}ElemType;
typedef struct /*线性表结构*/
{
ElemType *elem;
int length;
}STable;
STable *S; /*全局定义一个线性表*/

typedef struct LNode /*链表结构*/

{
int data;
struct LNode *next;
}LNode,* LinkList;
LinkList L; /*全局定义一个链表*/

void PrintF1(int n) /*输出函数。输出原线性表的值*/
{
int i;
for(i=1;i<n+1;i++)
{
printf("%d ",S->elem[i].key);
}
printf("\n");
}

void PrintF2() /*输出函数。输出改后链表的值*/
{
LinkList p=L;
for(;p;p=p->next)
{
printf("%d ",p->data);
}
printf