Hisoka Hunter
Hisoka Hunter

Reputation: 25

C : create string in char array from concatenation

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

Answers (1)

Some programmer dude
Some programmer dude

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

Related Questions