LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 848|回复: 4

what is segmentation fault??

[复制链接]
发表于 2005-3-31 11:04:20 | 显示全部楼层 |阅读模式
When I ran a program on Linux,an error occurred.It printed "segmentation fault".
I want to know what segement fault is,is it the error of my pointers?
I think it is at least a little about it.But in the following fragement:

int main(void){
state;
...
printf("result is :%d",result);
return 0;
}

Though the result is very right,it also printed"segmentation fault".Why???
发表于 2005-3-31 12:39:43 | 显示全部楼层
segmentation fault 就是访问了不该你访问的内存地址。

如果方便的话,把代码和输出的结果都贴出来看看。

:%  :%  :%   贴代码的时候前后分别加(code)和(/code),把圆括号换成方括号。
回复 支持 反对

使用道具 举报

发表于 2005-3-31 13:26:35 | 显示全部楼层
段错误
回复 支持 反对

使用道具 举报

发表于 2005-4-1 09:08:17 | 显示全部楼层
兄弟对内存的使用那块不行啊!
回复 支持 反对

使用道具 举报

发表于 2005-4-1 09:08:52 | 显示全部楼层
检查一下指针的使用。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表