I know that in C adjacent string literals are concatenated. I want to know, are adjacent string literals concatenated with char*s?
The reason I'm asking this question is because I want to pass a concatenation of two strings to perror()
, and one of the strings is not known in advance so I have to use a 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?