Ani*_*dha -3 c++
可能重复: 两个字符串文字的串联
案例1 "hello" "world"(无错误)
"hello" "world"
案例2 "hello"+"world"(错误)
"hello"+"world"
我知道+运算符必须有一个操作数string type,而不是string literal.
+
string type
string literal
事实是,这两种情况都没有意义,因为我们可以把它包括在内single literal!
single literal
为什么案例1允许呢!
unw*_*ind 5
情况1是允许的,因为C++基本上认为相邻的文字是相同的文字,即代码在解析的早期"hello" "world"转换"helloworld".
"helloworld"
归档时间:
13 年,8 月 前
查看次数:
125 次
最近记录: