【发布时间】:2019-07-13 16:32:03
【问题描述】:
我知道在 C 中相邻的字符串文字是连接在一起的。我想知道,相邻的字符串文字是否与 char*s 连接?
我问这个问题的原因是因为我想将两个字符串的串联传递给perror(),而其中一个字符串是事先不知道的,所以我必须使用char*。
perror("error opening " "file.txt"); // string literals are concatenated
char* filename = "file.txt"; // or some other file
perror("error opening " filename); // will this work?
【问题讨论】:
标签: c string-literals char-pointer