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

printf(“string1”“string2”)是这个有效的C?,第1张

概述当我写错误的时候,我试图找出一些东西 printf("string1""string2"); 令我惊讶的是,它编译并生成了一个串联的字符串输出,即 string1string2 这是有效的C吗? 我使用的是gcc版本4.4.1(Ubuntu 4.4.1-4ubuntu9) 是的.连续字符串文字在解析C的早期连接. 6.4.5 / 4: In translation phase 6, the mul 当我写错误的时候,我试图找出一些东西

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.

总结

以上是内存溢出为你收集整理的printf(“string1”“string2”)是这个有效的C?全部内容,希望文章能够帮你解决printf(“string1”“string2”)是这个有效的C?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1220445.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-05
下一篇 2022-06-05

发表评论

登录后才能评论

评论列表(0条)

保存