char * s =" Google" [英] char *s = "Google"

查看:108
本文介绍了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.

推荐答案

Le 13-12-2006,Sri Ragaventhirar< sr *************** @gmail.comaécrit*:
Le 13-12-2006, Sri Ragaventhirar <sr***************@gmail.coma écrit*:

char * s =" Google"


这个谷歌的位置会被存储?
char *s = "Google"

Where this "Google" will be stored?



某处你不能写入。

Somewhere you are not allowed to write in.


为什么不能改变?
Why it can''t be changed?



No.

No.


like s [1] =''h''; - 这是错误的

请解释一下。
like s[1]=''h''; -this is giving error
please explain this.



你正试图写一个禁止的地方。

你能做的是:

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


2006年12月13日00:55:28 -0800,Sri Ragaventhirar

< sr * **************@gmail.com写道:
On 13 Dec 2006 00:55:28 -0800, "Sri Ragaventhirar"
<sr***************@gmail.comwrote:

> char * s =" 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.



答案在FAQ 1.32中。

http://c-faq.com/decl/strlitinit.html


-

jay

The answer is in FAQ 1.32.

http://c-faq.com/decl/strlitinit.html

--
jay


这个字符串google将被存储在哪里?

为什么不能更改?

where this string "google"will be stored?
why it can''t be changed?


这篇关于char * s =&quot; Google&quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆