Gal*_*axy 1 c string-literals char-pointer
我知道在 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?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
253 次 |
| 最近记录: |