通常是用来按照一定的格式,给字符窜赋值的, 像char buf[100] = {0}; char [10] = "hello world"; char s2[10] = ""; sprintf(buf,"zifuchuan is %s,he int %s",,,s2); printf("buf = [%s]",buf);//输出是,也就是buf变成"zifuchuan is helloworld ,he int " 同样适合一些 int 类型, int int1= 10 像sprintf(buf,"%s,%s,%d",s1,s2,int1); 这样得出的字符串是"hellowolrd Tom 10"