Reputation: 25
I want to create a string in char array from concatenation in C
Example I want to do something similar to this
...
...
#define version "1.0"
char message[] = "Software version" + version + "\n"
...
...
Thanks
Upvotes: 1
Views: 66
Reputation: 409432
C has a feature to concatenate string literals during compilation, by just having white-space between the literals. Meaning you could do e.g.
char message[] = "Software version" version "\n"
Upvotes: 1