#include <iostream> using namespace std; char* GetMem(void) { char p[] = "hello"; return p; }; void main() { char c[] = "a"; char* ptr = c; ptr = GetMem(); //strcpy(ptr,"hello!"); cout << ptr << endl; cout << *ptr << endl; cout << &ptr << endl; }
Powered by: 博客园 Copyright © 2024 alexkk2011 Powered by .NET 9.0 on Kubernetes