我是靠谱客的博主 爱听歌墨镜,这篇文章主要介绍顺序表建表并遍历输出,现在分享给大家,希望可以做个参考。

#include<stdio.h>

#define MAXSIZE 100

typedef int ElemType;  //

typedef struct

{

    ElemType data[MAXSIZE];  //表内元素的个数

    int length;              //表的当前长度

} SqList;

 

void Sqlist_display(SqList L)  //输入的数据进行遍历

{

    int j;

    for(j=0;j<=L.length-1;j++)

    printf("%5d",L.data[j]);

    printf("n");   

}

int main(){

    SqList L;

    int j;

    printf("请输入元素的个数:n");

    scanf("%d", &L.length);

    printf("请输入各个元素:n");

    for (j = 0; j <= L.length-1;j++) 

    scanf("%d",&L.data[j]);

    Sqlist_display(L);       //调用Sqlist_display输出、输入的元素

}

最后

以上就是爱听歌墨镜最近收集整理的关于顺序表建表并遍历输出的全部内容,更多相关顺序表建表并遍历输出内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部