Possible Duplicate:
Macro for concatenating two strings in C
How to concatenate two strings with a macro?
I tried this but it does not give correct results:
#define CONCAT(string) "start"##string##"end"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to omit the
##: adjacent string literals get concatenated automatically, so this macro is going to concatenate the strings the way you want:For two strings:
Here is a link to a demo on ideone.