what could be wrong with the code?
i want some thing on local variable assinged a local pointer which is returned. The values are received correctly. But is it wrong practice or not? & what is a better way to do it.
Code:char ptr* GetSomething() { char buff[100] ; strcpy( buff, "C++") ; char *pLocalPtr ; pLocalPtr = buff ; return pLocalPtr ; } int main() { char *ptr = GetSomething() ; printf( "i got -- > %s", ptr ); }





Reply With Quote