#include <iostream>
#include <string>
using namespace std;
int main()
{
char * a;
a=new char[10];
//strcpy(a,"123456789");
sprintf(a,"123456789");//和上行效果一样
cout<<a<<endl;
delete []a ; //没有这行,会内存泄漏
system("pause");
return 0;
}