Why can't the token pasting operator be used to concatenate two strings? For example;
#include <stdio.h>
#define MESSAGE "hello"##"world"
int main() {
printf(MESSAGE);
}
error: pasting ""hello"" and ""world"" does not give a valid preprocessing token
Pasting 2 string literals is invalid because it does not form a valid single token. Note however that there is no need to use ## in this case as merely juxtaposing two (or more) string literals is legal and parsed as a single string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With