tail=(link)malloc(sizeof(node))

{ link ptr,head,tail; 
  int num,i;
  tail=(link)malloc(sizeof(node));
  tail->next=NULL;
  ptr=tail;
  printf("\nplease input 5 data==>\n");
  for(i=0;i<=4;i++)
  {
   scanf("%d",&num);
   ptr->data=num;
   head=(link)malloc(sizeof(node));
   head->next=ptr;
   ptr=head;
  }
ptr=ptr->next;
while(ptr!=NULL)
{ printf("The value is ==>%d\n",ptr->data);
  ptr=ptr->next;

}}

---------------------------------------------------------------------------------------------------------


http://www.qdxw.com.cn/yx/dwwf/2488671.html
http://www.lfxww.com/2014/shichangshangxun/2014/0423/839204.html
http://www.js0573.com/yx/jsfs/4444600.html
http://www.rznews.cn/yszx/stbk/5482712213.html
http://www.rznews.cn/yszx/stbk/5474504209.html
http://www.zznews.cn/hyzx/jkxx/5479137991.html
http://www.lfxww.com/2014/shichangshangxun/2014/0423/838907.html
http://www.zznews.cn/hyzx/jkxx/5479145838.html
http://www.rznews.cn/yszx/stbk/5474508372.html
http://www.lfxww.com/2014/shichangshangxun/2014/0423/839204.html
http://www.zznews.cn/hyzx/jkxx/5479155001.html
http://www.rznews.cn/yszx/stbk/5474988677.html
http://www.lfxww.com/2014/shichangshangxun/2014/0423/837559.html
http://www.zznews.cn/hyzx/jkxx/5451672959.html
http://www.js0573.com/yx/jsfs/4444600.html
http://www.lfxww.com/2014/shichangshangxun/2014/0423/838602.html
http://www.zznews.cn/hyzx/jkxx/5451688330.html
http://www.rznews.cn/yszx/stbk/5482712213.html
http://www.lfxww.com/2014/shichangshangxun/2014/0423/838647.html
http://www.zznews.cn/hyzx/jkxx/5451690985.html
http://www.js0573.com/yx/jsfs/4444524.html
http://www.zznews.cn/hyzx/jkxx/5451728897.html
http://www.qdxw.com.cn/yx/dwwf/2488671.html



-----------------------------------------------------------------------------
【程序74】
题目:连接两个链表。
1.程序分析:
2.程序源代码:
#include "stdlib.h"
#include "stdio.h"
struct list
{ int data;
struct list *next;
};
typedef struct list node;
typedef node *link;
link delete_node(link pointer,link tmp)
{if (tmp==NULL) /*delete first node*/
请参考我给出的代码框架,实现对EMPLOYEE结构体为数据的双向链表的排序算法,要求按照按employeeId升序排列 typedef struct linkNode { void* data; //使用空指针使得NODE适配多种数据结构 struct linkNode* preNode; struct linkNode* nextNode; }LINKED_NODE; /*Define the struct of double linked list.*/ typedef struct { LINKED_NODE* head; LINKED_NODE* tail; size_t size; }DOUBLE_LINK_LIST; typedef struct { int employeeId; char name[20]; char ipAddress[30]; char seatNumber[20]; char group[10]; } EMPLOYEE; DOUBLE_LINK_LIST* createDoubleLinkedList() { DOUBLE_LINK_LIST* newList = (DOUBLE_LINK_LIST*)malloc(sizeof(DOUBLE_LINK_LIST)); newList->head = NULL; newList->tail = NULL; newList->size = 0; return newList; } void destroyDoubleLinkedList(DOUBLE_LINK_LIST* list) {} /*Add a new node before the head.*/ void insertHead(DOUBLE_LINK_LIST* list, void* data) // void执政适配其他data类型? {} /*Add a new node after tail.*/ void insertTail(DOUBLE_LINK_LIST* list, void* data) // 如何适配其他data类型? {} /*Insert a new node.*/ void insertNode(DOUBLE_LINK_LIST* list, void* data,int index) // 如何适配其他data类型? {} void deleteHead(DOUBLE_LINK_LIST* list) {} void deleteTail(DOUBLE_LINK_LIST* list) {} void deleteNode(DOUBLE_LINK_LIST* list, int index) {} LINKED_NODE* getNode(DOUBLE_LINK_LIST* list, int index) {} /* 遍历链表,对每个节点执行指定操作*/ void traverseList(DOUBLE_LINK_LIST* list, void (*callback)(void*)) { LINKED_NODE* currentNode = list->head; while (currentNode != NULL) { callback(currentNode->data); currentNode = currentNode->nextNode; } } void printEmployee(void* data) {}
最新发布
07-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值