#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;
}

 

stack memory

 

stack memory

 

stack memory

 

stack memory

 

stack memory

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2022-01-31
  • 2022-12-23
猜你喜欢
  • 2022-03-08
  • 2021-11-06
  • 2021-09-16
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
相关资源
相似解决方案