Uh, no.
The way you have it designed, the caller *must* allocate the space; the callee *cannot* allocate it:
Code:
bool updateInfo(struct INFO* pInfo)
{
//UPDATE...
}
...
void someOtherProc ()
{
struct INFO *p = (struct INFO *)malloc (sizeof (struct INFO));
if (p != NULL)
updateInfo (p);
...
Suppose you did the "malloc()" inside updateInfo()? How is the caller going to get the new pointer, the one returned by "malloc()"? Certainly not through the "pInfo" parameter. You can change the *local* value of "pInfo" in "updateInfo()" ... but you cannot return the new value back to the caller.
Two alternatives might be:
a) make pInfo a pointer to a pointer ("struct INFO **ppInfo")
... or ...
b) make "udpateInfo()" return the pointer (instead of a "bool").
If your function simply "updates existing data", then like your original design better. Just allocate the struct before you call "updateInfo()", and Life is Good.
Otherwise, if your function is actually "add new member to list", then I'd allocate inside the function ... and pass a pointer to a pointer. Here's an example:
http://vergil.chemistry.gatech.edu/r...ial/lists.html
IMHO .. PSM