拈花小仙 发表于 2014-9-20 16:54:47

很无聊的链表

#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++编程小组

hacker.jin 发表于 2014-9-20 17:19:02

你敢带注释吗??
页: [1]
查看完整版本: 很无聊的链表