C语言 c编程中“”和“ ”有什么区别
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25384517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Whats the difference between " " and ' ' in c programming
提问by Cheyenne Forbes
Can anybody explain the difference between " " and ' ' in c programming? its getting to mi example:
任何人都可以解释 c 编程中“”和“ ”之间的区别吗?它得到了我的例子:
if i use ' '
如果我使用 ' '
date=type=='a';
if (date)
{
printf("its a date");
printf("%d",date);
}
it prints 1 and if i use " "
它打印 1,如果我使用“”
date=type=="a";
if (date)
{
printf("its a date");
printf("%d",date);
}
it prints 0
它打印 0
回答by Rahul Tripathi
Double quotes is for string and single quotes for character. But since you are using character in both of your samples then it doesnt make any difference. You can store character using double quotes but not the vice versa
双引号用于字符串,单引号用于字符。但是由于您在两个样本中都使用了字符,因此它没有任何区别。您可以使用双引号存储字符,但反之则不行

