提交 e6cdb069 创建 作者: 宋海霞's avatar 宋海霞

modify

上级 f84ac888
#ifndef DOUBLELINKLIST_H_
#define DOUBLELINKLIST_H_
//
// Include the C standard library header file here
//
......@@ -13,16 +12,14 @@
// Other header files are included here
//
//
// Define the data structure here
//
typedef int ElemType; // The type of an element in a linked list
typedef struct DuLNode {
typedef struct DuLNode
{
ElemType data; // Data fields
struct DuLNode* prior; // Precursor pointer
struct DuLNode* next; // Subsequent pointer
......
#include "DoubleLinkList.h"
#include <stdlib.h>
int main(int argc, char* argv[])
{
int i;
ElemType Elem;
DuLinkList* pListHead; // A pointer to the head of a bidirectional circular list,Points to the header node
// A pointer to the head of a bidirectional circular list,Points to the header node
DuLinkList* pListHead;
DuLinkList* pListNode; // Bidirectional circular list node pointer
DuLinkList* pListHeadTemp;
//
......@@ -18,7 +19,7 @@ int main(int argc, char* argv[])
//
// Initializes the nodes of a bidirectional circular list
//
for(i=8; i>0; i--)
for (i=8; i>0; i--)
{
pListNode = (DuLinkList*)malloc(sizeof(DuLinkList));
pListNode->data = i;
......@@ -37,7 +38,7 @@ int main(int argc, char* argv[])
pListHeadTemp = pListHead;
pListNode = pListHeadTemp->next;
while(pListNode != pListHeadTemp)
while (pListNode != pListHeadTemp)
{
printf("%d ", pListNode->data);
pListNode = pListNode->next;
......@@ -47,7 +48,7 @@ int main(int argc, char* argv[])
//
// Destroy bidirectional circular linked list
//
while(pListHead->next != pListHead)
while (pListHead->next != pListHead)
{
pListNode = pListHead->next;
pListHead->next = pListNode->next;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论