很无聊的链表
#include <stdio.h>#include <stdlib.h>
#include <malloc.h>
typedef struct listNode
{
int data;
struct listNode* link;
}node;
node* create3();
int main()
{
node* list = create3();
printf("%d,",list->data);
printf("%d,",list->link->data);
printf("%d\n",list->link->link->data);
return 0;
}
node* create3()
{
node *first,*second,*third;
first = (node* )malloc(sizeof(node));
second = (node* )malloc(sizeof(node));
third = (node* )malloc(sizeof(node));
third-> link = NULL;
third-> data = 30;
second-> link = third;
second-> data = 20;
first-> link = second;
first-> data = 10;
return first;
}
C++编程小组 你敢带注释吗??
页:
[1]