内存拷贝

#include <iostream>
using namespace std;

int main()
{
int b[]={1,2,3};
int *a;
a=(int*)malloc(sizeof(int)*3);
memcpy(a,b,sizeof(int)*3);

for (int i=0;i<3;i++)
cout<<a[i]<<"";

cout<<endl;
system("pause");
free(a);
return 0;
}
posted @ 2012-02-17 21:36  Dsp Tian  阅读(493)  评论(0编辑  收藏  举报