Inside a function for linked list:
// nodePtr is a pointer to a struct
// list is a pointer to the linked list
nodePtr *current = list;
[some manipulation using *current here...]
// insert new node in front of *current node
nodePtr temp = *current;
*current = createNode(value);
(*current)->next = temp;
Because temp is not a direct pointer so when I assigned (*current)->next back to temp, will it creates a copy in the heap? And then the original memory now has no pointer to it and leaked?
I was trying to setup an insert function for a linked list that insert the node in order (a member in struct to check the value) so it requires no sorting.
typedefs
! – Oliver Charlesworth