假设我有一个字符串const char *temp = "i am new to C"
。
现在我有一个浮点变量a=1.0000;
如何将 const char *temp
中的“a”值与现有字符串一起发送。
提前致谢。
最佳答案
const char temp[] = "I am new to C";
float a = 1.0;
char buffer[256];
sprintf(buffer, "%s %f", temp, a);
关于c - 使用 C 在字符串内传递变量值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7523079/