标志'与\'相同? [英] Sign ' is the same as \' ?

查看:66
本文介绍了标志'与\'相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我很惊讶地发现sign''的值与\''相同。那么,

没有必要在签名之前添加符号\?在我以前对

sign''的了解中,我们总是需要在签名之前添加符号\。有什么意见吗?


这是我要测试的简单程序。

Hello everyone,
I am surprised to see that the value of sign '' is the same as \''. So,
there is no need to add sign \ before sign ''? In my past knowledge of
sign '', we always need to add sign \ before sign ''. Any comments?

Here is my simple program to test.

展开 | 选择 | 换行 | 行号

推荐答案

在文章< e8 ********************************** @ a39g2000pre。 googlegroups.com>,

George2< ge ************* @ yahoo.comwrote:
In article <e8**********************************@a39g2000pre. googlegroups.com>,
George2 <ge*************@yahoo.comwrote:

>我很惊讶地发现sign''的值与\''相同。那么,
没有必要在签名前添加符号\?
>I am surprised to see that the value of sign '' is the same as \''. So,
there is no need to add sign \ before sign ''?



没有必要在字符串中的单引号前加一个反斜杠,

但是在一个字符常量中你需要它:


char * s ="''" ;;

char c =''\'''';


相反,你需要在字符串中的双引号之前使用反斜杠,但

不在字符常量中:


char * s = " \"" ;;

char c =''"'';


即使没有,你也可以使用反斜表格必要的。


- 理查德

-

需要考虑多达32个字符的需要

在某些字母表中" - X3.4,1963。

There''s no need to put a backslash before a single quote in a string,
but in a character constant you need it:

char *s = "''";
char c = ''\'''';

Conversely you need a backslash before a double quote in a string, but
not in a character constant:

char *s = "\"";
char c = ''"'';

You are allowed to use the backslashed forms even when not necessary.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.


George2写道:
George2 wrote:

大家好,


我很惊讶地发现sign''的值与\''相同。那么,

没有必要在签名之前添加符号\?在我以前对

sign''的了解中,我们总是需要在签名之前添加符号\。任何意见?
Hello everyone,
I am surprised to see that the value of sign '' is the same as \''. So,
there is no need to add sign \ before sign ''? In my past knowledge of
sign '', we always need to add sign \ before sign ''. Any comments?



这个片段


char ch =''a'';

printf(" ;这是Jon%cs \ nn,ch;


....打印它是Jonas。你的任务,如果你选择

接受它,就是改变第一行以使输出为

它是Jon'的。


-

Eric Sosman
es*****@ieee-dot-org.inva 盖子


Eric Sosman写道:
Eric Sosman wrote:

George2写道:
George2 wrote:

>大家好,

我很惊讶地发现sign''的值是与...一样 \''。那么,
没有必要在签名前添加符号\?在我以前对
sign''的了解中,我们总是需要在签名之前添加符号\。任何意见?
>Hello everyone,
I am surprised to see that the value of sign '' is the same as \''. So,
there is no need to add sign \ before sign ''? In my past knowledge of
sign '', we always need to add sign \ before sign ''. Any comments?



这个片段


char ch =''a'';

printf(" ;这是Jon%cs \ n",ch);


...打印它是Jonas。你的任务,如果你选择

接受它,就是改变第一行以使输出为

它是Jon'的。


This snippet

char ch = ''a'';
printf ("It''s Jon%cs\n", ch);

... prints "It''s Jonas". Your mission, should you choose to
accept it, is to change the first line to make the output be
"It''s Jon''s".



您如何建议让您的帖子自毁?

How do you propose to make your posting self-destruct?


这篇关于标志'与\'相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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