I've created the following linked list struct:
struct node {
struct data *data;
struct node *next;
};
My problem is that when I'm trying to create a function that returns this linked list struct, I'm getting the following error message:
"Conflicting types for 'function'".
My function looks like this :
struct list_node *function(location piece){
struct list_node *details;
details = malloc( sizeof(struct list_node) );
details->next = NULL;
details->current = NULL;
if (global_var == WHITE_M){
struct list_node *temp;
temp = malloc( sizeof(struct list_node) );
data new_data;
*temp->data = new_data;
temp->next = malloc( sizeof(struct list_node) );
temp->next = details;
details = temp;
}
return details;
}
Actually what I'm trying to do in my function is creating new linked list, then connecting new nodes to it, and return the linked list.
Every return phrase I've tried, and evert declaration I've tried brought me to the same error, can someone please help me ?