加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

printf(“string1”“string2”)是这个有效的C?

发布时间:2020-12-16 10:28:30 所属栏目:百科 来源:网络整理
导读:当我写错误的时候,我试图找出一些东西 printf("string1""string2"); 令我惊讶的是,它编译并生成了一个串联的字符串输出,即 string1string2 这是有效的C吗? 我使用的是gcc版本4.4.1(Ubuntu 4.4.1-4ubuntu9) 解决方法 是的.连续字符串文字在解析C的早期连接.
当我写错误的时候,我试图找出一些东西

printf("string1""string2");

令我惊讶的是,它编译并生成了一个串联的字符串输出,即

string1string2

这是有效的C吗?

我使用的是gcc版本4.4.1(Ubuntu 4.4.1-4ubuntu9)

解决方法

是的.连续字符串文字在解析C的早期连接.

6.4.5 / 4:

In translation phase 6,the multibyte character sequences specified by any sequence of adjacent character and wide string literal tokens are concatenated into a single multibyte character sequence. If any of the tokens are wide string literal tokens,the resulting multibyte character sequence is treated as a wide string literal; otherwise,it is treated as a character string literal.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读