If i create a function:
And use it like this:Code:char *fn1(){
char *retVal=new char[100];
strcpy(retVal, "test");
return(retVal);
}
Is this the correct way to return a pointer to char?Code:char *ptr=0;
if(ptr=fn1())
printf(ptr);
delete [] ptr;
Does the compiler know the amount of allocated memory, or am i messing everything up?