【发布时间】:2019-03-03 23:01:12
【问题描述】:
我需要连接一个字符串和一个变量来填充另一个字符串:
#include <stdio.h>
int main(){
char *te1;
char *te2;
char *tabela[2];
te1 = "text 1";
te2 = "text 2";
tabela[0] = "text 0, " + te1 + ", " + te2;
printf("%s\n", tabela[0]);
return 0;
}
预期结果:
文字 0、文字 1、文字 2
【问题讨论】:
标签: c arrays string concatenation