求助,指针问题(2级C语言考试题)
代码如图所示
程序代码:#include <stdio.h>
#include <string.h>
void fun(char *w,int n)
{
char t, *s1, *s2;
s1 = w;
s2 = w + n - 1;
while(s1 < s2)
{
t = *s1++;
*s1 = *s2--;
*s2 = t;
}
}
int main(void)
{
char *p;
p = "1234567";
fun (p, strlen(p));
puts(p);
return 0;
}在linux系统下,"cc -Wall unknow.c"生成目标文件,为什么运行出现断错误?
[[it] 本帖最后由 spadgeletov 于 2008-10-19 20:58 编辑 [/it]]








