Incompatible return types
Sorry if this is too simple a question. I'm just really upset.
I am getting the following error when compiling:
sll.c:129: error: incompatible types in return
Here is my structure definition at the top of my file, you might need to understand the function where the error occurs:
struct string_linked_list {
char *s;
struct string_linked_list *next;
};
typedef struct string_linked_list SLL;
Here is a function that returns an error. I wrote this function to just build a singleton list for testing purposes.
SLL makeSingleton()
{
SLL * new= (SLL *) malloc( sizeof(SLL));
char*sp = strdup("test");
new->s = sp;
new->next = NULL;
return new;
}
Do you have any idea what the problem might be?
+3
source to share