Hi all,
This is probably quite a newbie question.
I have a function that takes in a pointer as a paramter. How can I tell if the pointer has previously called malloc()?
In addition to this, if all I want to do is to change the value of say a char*, could I get around this problem by just calling realloc() (I think that was the name of the function).
Anyway, I guess my original question still stands. How can you tell programatically if the pointer you are given as a parameter to a function has already had malloc called upon it.
I don't think an if statement like the following quite cuts it...
Anyway, what advice to you have?Code:if (pointer) { printf("The pointer has had memory allocated.\n"); }
Thanks
Eddie



LinkBack URL
About LinkBacks


