社区
数据结构与算法
帖子详情
struct自己调用自己
C瓜哥
2009-12-10 07:33:37
定义一个结构体
struct A{
int x;
struct A *next;
};
然后在主函数中调用
struct A a,*p;
a.next->x=100;
p->next->x=a.next->x;
cout<<p->next<<endl;
编译、连接都能通过,但是运行时会产生错误!到底是怎么回事呀????菜鸟求救!!!!!!!!!!!!
...全文
191
2
打赏
收藏
struct自己调用自己
定义一个结构体 struct A{ int x; struct A *next; }; 然后在主函数中调用 struct A a,*p; a.next->x=100; p->next->x=a.next->x; cout<next<<endl; 编译、连接都能通过,但是运行时会产生错误!到底是怎么回事呀????菜鸟求救!!!!!!!!!!!!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
borefo
2009-12-10
打赏
举报
回复
struct A a,
b,
*p;
a.next->x = 100;
p = &b;
p->next->x = a.next->x;
donkey301
2009-12-10
打赏
举报
回复
所有指针都要开辟空间才能使用
Go语言官方文档学习笔记(第五季)
Go富有表现力,简洁,整洁且高效。它的并发机制使编写程序可以轻松地从多核和联网机器中获得最大收益,而其新颖的类型系统则可以实现灵活的模块化程序构造。Go可以快速编译为机器代码,但具有垃圾回收的便利性和运行时反射的功能。它是一种快速的,静态类型的编译语言,感觉就像是一种动态类型的解释语言。Go语言官方文档学习笔记是基于官方文档及个人学习Go的笔记,整理完成的Go语言快速入门课程。第五季内容包括以下十个部分:1-
Struct
s2-
Struct
Fields3-Pointers to
struct
s4-
Struct
Literals5-Arrays6-Slices7-Slices are like references to arrays8-Slice literals9-Slice defaults10-Slice length and capacity课程目录
Golang
struct
动态
调用
其方法和属性
package main import ( "fmt" "reflect" ) type MyStr1
struct
{ } func (y *MyStr1) Test1() { fmt.Println("Test1 called") } type MyStr2
struct
{ } func (y *MyStr2) Test2(i int, oo string) { fmt.P...
linux工作队列 - work_
struct
被
调用
过程
work_
struct
被
调用
在函数worker_thread中进行,代码如下:static int worker_thread(void *__worker) {
struct
worker *worker = __worker;
struct
worker_pool *pool = worker->pool; /* tell the scheduler that this i
Go
调用
struct
或interface自定义的内部方法(函数)
- package main import "fmt" // ------------------------------ // Function 封装接口,仅暴露参数 type Function
struct
{ Name string } func (fun *Function)Get() (name string) { name = fun.Name + "-Get" return } func (fun *Function)Set(name string) { fun.Nam
Go语言
struct
的创建与初始化、函数
调用
Go语言
struct
的创建与初始化、函数
调用
package
struct
Test //
struct
//Date:2014-4-1 09:57:37 import ( "fmt" "strings" ) func
Struct
Test01Base() { //
struct
Test0101() //
struct
Test0102()
struct
Test0103() } ...
数据结构与算法
33,010
社区成员
35,327
社区内容
发帖
与我相关
我的任务
数据结构与算法
数据结构与算法相关内容讨论专区
复制链接
扫一扫
分享
社区描述
数据结构与算法相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章