标签: c
我有一个文本,我想用C中的数据填充它
char arr[100]="Ahmed %s salah %s is %d";
我要添加数据,而不是%s和%d 成为
arr="Ahmed Elsayed salah Elsenbawy is 16";
答案 0 :(得分:3)
只需使用sprintf或snprintf。
在这种情况下,使用char *会导致缓冲区溢出。
x