指针数组

 1 #include <iostream>
 2 using namespace std;
 3 double* aaa()
 4 {
 5     double tmp[3] = { 1.0,2.0,3.0 };
 6     double* tmp1 = new double[3];
 7     for (size_t i = 0; i < 3; i++) tmp1[i] = tmp[i];
 8     return tmp1;
 9 }
10 
11 
12 int main()
13 {    
14     double* a = new double[3];
15     a = aaa();
16     for (size_t i = 0; i < 3; i++)
17     { 
18         cout << *(a+i) << endl; 
19     }
20     delete[]a;
21     system("pause");
22 }
原文地址:https://www.cnblogs.com/liuxiaoqing1/p/14457118.html