void main() {char *a="abcdefgh"; fun(a); puts(a); } void fun(char*s) { int x=0,y; char c;#include#includevoid main(){char *a="abcdefgh";fun(a);puts(a);}void fun(char*s){\x05int x=0,y;\x05char c;\x05for(y=strlen(s)-1;x

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/17 10:31:10
void main() {char *a=
xݒN@_e SQ`iZ0BA%=@FB&|S++.-Řvfw:N%"Nn3q^:L$;(˰nC.Q87㽂ld~"G,P[ If"QXRgKY ӌxw.(du  yn}u\cm:Zbx]bYߦΐ\(_^o &jR'DJ3dQy^XBg]u6P.Bɲ^#jmXF7UMo^EWƓs(MB`ڬ4Ӂ*g說6ha3[bm]Pg6블 _;t24D[?9Gۨo;Xyiҷ#pNfC~w

void main() {char *a="abcdefgh"; fun(a); puts(a); } void fun(char*s) { int x=0,y; char c;#include#includevoid main(){char *a="abcdefgh";fun(a);puts(a);}void fun(char*s){\x05int x=0,y;\x05char c;\x05for(y=strlen(s)-1;x
void main() {char *a="abcdefgh"; fun(a); puts(a); } void fun(char*s) { int x=0,y; char c;
#include
#include
void main()
{char *a="abcdefgh";
fun(a);
puts(a);
}
void fun(char*s)
{
\x05int x=0,y;
\x05char c;
\x05for(y=strlen(s)-1;x

void main() {char *a="abcdefgh"; fun(a); puts(a); } void fun(char*s) { int x=0,y; char c;#include#includevoid main(){char *a="abcdefgh";fun(a);puts(a);}void fun(char*s){\x05int x=0,y;\x05char c;\x05for(y=strlen(s)-1;x
问题在于,你调用fun函数传入的是一个常量串地址,常量串是存放在进程空间的堆中的常量区,是不能修改的.同时fun函数应该在main函数前声明一下,代码应该改为:
#include
#include
void fun(char*s);
void main()
{char a[]="abcdefgh"; /---------------------------/
fun(a);
puts(a);
}
void fun(char*s)
{
\x05int x=0,y;
\x05char c;
\x05for(y=strlen(s)-1;x