Click here to Skip to main content
15,796,982 members

Comments by Member 15046944 (Top 4 by date)

Member 15046944 15-Jan-21 11:48am View    
So, how to deallocate a node is only known to the client code who is using linked list. Hence linked list will take function pointers to call those respective functions
Member 15046944 15-Jan-21 11:46am View    
during insertion/deletion you call those callback functions.

e.g., delete operation will take another param of function pointer type. And inside your delete function you will invoke the callback. This way the client code is responsible for allocating/deallocating memory for the node data. The linked list will only call the callback function for insertion/deletion
Member 15046944 15-Jan-21 11:43am View    
I don't wanna pass size as the function parameter
I want to implement a separate function for allocation/deallocation of node data
Member 15046944 15-Jan-21 11:41am View    
I have implemented the generic linked list with the following code given
Code has no errors but now I want to implement the following changes
1)Not passing the size in push function
2)for memory allocation and deallocation of the node data I want to implement a separate function