void arrDemo8() { int* p; p = returnArr(); cout << typeid(p).name() << endl; for (int i = 0; i < 10; i++) { cout << *(p+i) << endl; } } int* returnArr() { static int arr[10]; for (int i = 0; i < 10; i++) { arr[i] = i * i; } return arr; }
void arrDemo8() { int* p; p = returnArr(); cout << typeid(p).name() << endl; for (int i = 0; i < 10; i++) { cout << *(p+i) << endl; } } int* returnArr() { static int arr[10]; for (int i = 0; i < 10; i++) { arr[i] = i * i; } return arr; }