#3664. [GESP202312 六级 C++] 第 21 题
[GESP202312 六级 C++] 第 21 题
在下面 C++ 代码中,由于删除了变量 ptr,因此 ptr 所对应的数据也随之删除,故第 8 行代码被执行时,将报错。
int * ptr=new int(10);
cout<<*ptr<<endl;
delete ptr;
cout<<*ptr<<endl;
{{ select(1) }}
- 正确
- 错误
在下面 C++ 代码中,由于删除了变量 ptr,因此 ptr 所对应的数据也随之删除,故第 8 行代码被执行时,将报错。
int * ptr=new int(10);
cout<<*ptr<<endl;
delete ptr;
cout<<*ptr<<endl;
{{ select(1) }}