| 查看: 242 | 回复: 1 | |||
zhaowengen木虫 (小有名气)
|
[求助]
为什么这个程序会发生运行时错误?
|
|
#include <stdio.h> #define NULL 0 #define FALSE 0 #define TRUE 1 char * match(char * str, char * want) { while(*want != '\0') { if(*str++ != *want++) return NULL; } return str; } int del_substr(char * str, char const * substr) { char * next = NULL; while(*str != '\0') { next = match(str, (char *)substr); if(next != NULL) break; str++; } if(*str == '\0') return FALSE; while(*str++ = *next++) ; return TRUE; } int main(void) { char * str = "ABCDEFG"; char * substr = "CD"; int val = 0; val = del_substr(str, substr); printf("%s\n", str); return 0; } |
» 猜你喜欢
投稿Elsevier的Neoplasia杂志,到最后选publishing options时页面空白,不能完成投稿
已经有22人回复
申请26博士
已经有5人回复
职称评审没过,求安慰
已经有22人回复
垃圾破二本职称评审标准
已经有15人回复
EST投稿状态问题
已经有7人回复
毕业后当辅导员了,天天各种学生超烦
已经有4人回复
聘U V热熔胶研究人员
已经有10人回复
求助文献
已经有3人回复
投稿返修后收到这样的回复,还有希望吗
已经有8人回复
三无产品还有机会吗
已经有6人回复
zhaowengen
木虫 (小有名气)
- 应助: 1 (幼儿园)
- 金币: 4389.7
- 帖子: 102
- 在线: 134.9小时
- 虫号: 3760377
- 注册: 2015-03-24
- 性别: GG
- 专业: 计算机网络
2楼2015-08-21 10:58:04













回复此楼