简体   繁体   English

C:通过串联在char数组中创建字符串

[英]C : create string in char array from concatenation

I want to create a string in char array from concatenation in C 我想从C串联在char数组中创建一个字符串
Example I want to do something similar to this 示例我想做类似的事情

...
...
#define version "1.0"

char message[] = "Software version" + version + "\n"
...
...  

Thanks 谢谢

C has a feature to concatenate string literals during compilation, by just having white-space between the literals. C具有在编译过程中连接字符串文字的功能,即在文字之间仅留有空格。 Meaning you could do eg 意味着你可以做例如

char message[] = "Software version" version "\n"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM