下面这个程序怎么才能用C语言表达出来啊
还要在TC上运行。。。怎么弄啊
是不是先得把元素类型定义成整型啊。。。。
有谁能整明白吗,麻烦你们啦
拜托各位啦!         
题目:单链表的操作
内容:1、建立如下单链表(87,95,26,38,92,77)
2、将64插入到第四个元素之前
3、删除第六个元素
估计这是你的作业吧,我给出2/3的代码,第3小题我没有做,你自己研究哈。
#include <stdio.h>
#include <alloc.h>
typedef struct a
{
  int num;
  struct a *next;
}lianbiao;
main()
{
  int a[]={87,95,26,38,92,77},n;
  lianbiao first;
  lianbiao *p=&first,*temp;
  /*建立链表*/
  p->num=a[0];
  p->next=NULL;
  for(n=1;n<=5;n++)
  {
   if((temp=((lianbiao *)malloc(sizeof(lianbiao))))==NULL)printf("Error.");
   p->next=temp;
   p=p->next;
   p->num=a[n];
   p->next=NULL;
  }
  /*插入*/
  p=&first;
  for(n=1;n<=2;n++)/*指向26,为了在26后面插入64,64是第四个元素*/
  {
    p=p->next;
  }
  if((temp=((lianbiao *)malloc(sizeof(lianbiao))))==NULL)printf("Error.");
  temp->num=64;
  temp->next=p->next;
  p->next=temp;
  p=&first;
}
[此贴子已经被作者于2006-9-29 20:58:56编辑过]