I have a double link list that stores some information. When I try and return one of the values inside the link list, I get the warning: function returns address of local variable.
This is my return statement:
return curr_val->value;
value is of type const void*
.
Method signature is like: void *get_val(int key)
curr_val
is of a struct type. It is equal to one of my nodes in the linked list.
how do I return the value and it not disappear after I return? BTW, I can not change the method signature.