小编Ami*_*mit的帖子

如何在字符串中集成int变量?

#include<stdio.h>

main()
{
    int i=100;
    char temp[]="value of i is **** and I can write int inside a string";
    printf("\n%s\n",temp);

}
Run Code Online (Sandbox Code Playgroud)

我需要i在字符串中打印值.这样我就可以得到输出:

value of i is 100 and I can write int inside a string
Run Code Online (Sandbox Code Playgroud)

我应该在****的地方写些什么,或者如何更改此代码以获得上述输出?我不想printf用来打印这个输出.

c string int

2
推荐指数
1
解决办法
200
查看次数

标签 统计

c ×1

int ×1

string ×1