#include <stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
int main(int argc, char *argv[])
{
char out_buf[100];
char *str="hello world";
int num=110;
sprintf(out_buf,
"%s.%d",str,num);
printf(
"%s\n",out_buf);
return 0;
}

  

sprintf和printf的不同点:

printf是将数据打印到标准输出中.
sprintf是将数据打印到buf中.(数组里面)

相关文章:

  • 2021-11-10
  • 2022-12-23
  • 2021-12-09
  • 2021-07-07
  • 2022-01-31
  • 2021-06-05
猜你喜欢
  • 2022-12-23
  • 2021-12-13
  • 2021-08-20
  • 2021-09-11
  • 2021-07-08
  • 2022-12-23
  • 2022-02-24
相关资源
相似解决方案