加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

(1)编写一个逐个输出顺序表中所有数据元素的成员函数。并编写主函数测试结果。

(2012-05-29 18:27:23)
标签:

顺序表

数据元素

测试结果

函数

编写

it

#include <stdio.h>
#define maxsize 20
typedef int datatype;
typedef  struct{
datatype data[maxsize];
int last;        
}sequenlist;
 

void CreateList(sequenlist *L,int n)
{int i;
printf("please input n numbers\n");
for(i=0;i<n;i++)
  {
    scanf("%d",&L->data[i]);
    (*L).last=n;
  }
}
 

void PrintList(sequenlist *L,int n)
{int i;
 printf("the sequenlist is\n");
 for(i=0;i<n;i++)
   printf("%d ",L->data[i]);
}

main()
{
  int i,x;
  int n=10;
  sequenlist L;
  CreateList(&L,n);
  PrintList(&L,n);
  getchar();
  getchar();  
}

 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有