打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
插入9个结点

#include <stdlib.h>

#include <iostream>

using namespace std;

typedef struct aaa *node ;

struct aaa

{

int value;

node next;

};

int main()

{

//ofstream write;write.open("1.txt");

//write<<1;

node head=(node)malloc(sizeof(struct aaa));head->value=711;head->next=NULL;

int i=1;int n=9;

while(n--){node t=(node)malloc(sizeof(struct aaa));t->value=i;i++;t->next=head;head=t;}

//reverse(a);

int j=1;

while(head){cout<<"结点 "<<j<<" = "<<head->value<<endl;head=head->next;j++;}

   return 0;

}

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
剑指offer之C语言实现链表(两种方式)
C/C++版数据结构之链表<二>(转)
翻转单链表
Linux 环境下C语言编译实现贪吃蛇游戏
C语言中 ->叫做结构体指针运算符
数据结构——链表PTA习题
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服