C supports concatenating constant strings at compile-time. Can I do the same for any constant array? (E.g. concatenate two char ** arrays.)
C supports concatenating constant strings at compile-time. Can I do the same for any
Share
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.
Basically no, but you can always workaround this with the preprocessor. The trick is to define arrays without curly braces:
Now, you can join arrays in compile time with comma.
To use them, however, you will either have to sorround them with curly braces or use a macro:
You can now use a single array or any concatenation you need like so:
Using macros to achieve such results is bad practice, though.