C语言字符串空格分隔
char str[]="hello" "World";
这个是什么语法,没有看到过。哪里有讲解吗?
回答:
"hello" "World" => "helloWorld"
c语言会忽略多个定义字符串之间的空白字符,把这些字符串拼接为一个字符串。
en.cppreference.com/w/c/language/string_literal
First, at translation phase 6 (after macro expansion), the adjacent string literals (that is, string literals separated by whitespace only) are concatenated.
char* p = "\x12" "3"; // creates a static char[3] array holding {'\x12', '3', '\0'} // sets p to point to the first element of the array
//char* p = "\xfff"; // error: hex escape sequence out of range
char* p = "\xff""f"; // okay, the literal is char[3] holding {'\xff', 'f', '\0'}
回答:
ANSIC中引入的新特性,上一个书上例子,《C专家编程》中的例子。
以上是 C语言字符串空格分隔 的全部内容, 来源链接: utcz.com/p/195736.html