what's wrong with this C++ code?# Programming - 葵花宝典
a*n
1 楼
char* getName()
{
char* name = "tony";
return name;
}
This function return a local pointer. However, "tony" is a string literal.
Isn't it in the global namespace?
Thanks.
{
char* name = "tony";
return name;
}
This function return a local pointer. However, "tony" is a string literal.
Isn't it in the global namespace?
Thanks.