C++????????л??????
???????????? ???????[ 2012/8/6 9:59:09 ] ????????
????C++???д?????ū??????????????? ?????JingWei??Xiaoma?????????ū???????????????????????????????
???????????
????C++?У???????????棬new??????飬?????????У????????????????????С???е???????????????????????????????????????????????delete?????
????????????????
int* Func1()
{ int p[2];//????????
p[0]=1;
p[1]=2;
return p;
}
int main()
{
int *p=Func1();
cout<<p[0]<<endl;
return 0;
}
??????????????? ???p?????????????У????????????????????????????????????????????????????????????????????????????????????棬????????????????????????????????????????????£????????????????£?
int main()
{
int *p=Func1();
int temp[20]={0};//????????Щ????????????
cout<<p[0]<<endl;
return 0;
}
?????????????????????????????????????????????p??????????????????Ч??
?????????????????new ???????????????飺
int* Func1()
{
int *p=new int[2];//?????????
p[0]=1;
p[1]=2;
return p;
}
int main()
{
int *p=Func1();//?????Func1???????????????
cout<<p[0]<<endl;//??????
return 0;
}
??????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11