at the moment I have
void clistDeleteNode(clist_t *list,cnode_t **pnode) {
cnode_t *node=*pnode;
/* stuff done with node here, removed for clarity */
free(*pnode);
*pnode=0;
}
which is called with
clistDeleteNode(list,&aNode);
The function automatically NULL’s the end user pointer after its freed – I do this as it makes debugging and leak checking easier.
is there a more elegant way to pass a pointer to a function such as it an be modified without having to use *&*aNode ? (from the end users point of view)
Unlike C++, there isn’t a way of passing the address of
aNodewithout having used the&operator in the calling function.Using the pre-processor to hide what you’re actually doing would most likely be considered a less “elegant” way than the above clear way.