什么是悬空的指针?
void foo(const std::string name){ // will it be Dangling pointer?!, with comments/Answer // it could be if in new_foo, I store name into Global. // Why?! And what is safe then? new_foo(name.c_str());}void new_foo(const char* name){ // print name or do something with name... }
DIEA
跃然一笑
四季花海
相关分类