|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#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;
}
|
|