c语言中双引号和单引号_C中的双引号与单引号

c语言中双引号和单引号

In C you might find yourself using double quotes in some cases, and single quotes in other cases.

C中,您可能发现自己在某些情况下使用双引号,而在其他情况下使用单引号。

In some languages, there’s no difference between the two. But in C, there is difference, and you’ll use one vs the other depending on the need.

在某些语言中,两者之间没有区别。 但是在C语言中,存在差异,您将根据需要使用一个与另一个。

When can you use single quotes and when can you use double quotes?

什么时候可以使用单引号,什么时候可以使用双引号?

Single quotes are used to identify a single character (char value):

单引号用于标识单个字符( char值):

char letter = 'a';

Double quotes are used to create a string literal:

双引号用于创建字符串文字:

char *name = "Flavio";

Note that you can create a single-letter string literal:

请注意,您可以创建一个单字母字符串文字:

char *letter = "a";

But remember that a string is composed by the characters of the string, plus a 0 character at the end, which makes single-letter string literals take double the space of a single character.

但是请记住,字符串是由字符串的字符组成的,最后是一个0字符,这使得单字母字符串文字占用的空间是单个字符的两倍。

翻译自: https://flaviocopes.com/c-quotes/

c语言中双引号和单引号

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值