本文介绍了char * s =" Google"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
char * s =" Google"
此处Google将被存储?
为什么不能改变?
喜欢s [1] =''h''; - 这是错误的
请解释一下。
char *s = "Google"
Where this "Google" will be stored?
Why it can''t be changed?
like s[1]=''h''; -this is giving error
please explain this.
推荐答案
某处你不能写入。
Somewhere you are not allowed to write in.
No.
No.
你正试图写一个禁止的地方。
你能做的是:
char s [] =" Google";
然后,你被允许做
s [1] =''h'';
Marc Boyer
You are trying to write in a forbiden place.
What you can do is:
char s[]= "Google";
and then, you are allowed to do
s[1]= ''h'';
Marc Boyer
答案在FAQ 1.32中。
-
jay
The answer is in FAQ 1.32.
http://c-faq.com/decl/strlitinit.html
--
jay
这篇关于char * s =" Google"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!