I'm, trying to build a generic list that handles Element(s) each object (pointer to struct) in the program should use this list,
that's the definition for void*, from now on it's Element. and the add function signature:
typedef void* Element;
void AddElementToList(List thisList , Element toAdd);
and the create user function and the user definition:
typedef struct FacebookUser_t* User;
User CreateUser(char* const lineToSplit);
that's how i call the function:
AddElementToList(thisServer->UsersList , (Element)CreateUser(line));
while debugging the create user function doing good and values assigned to it, just after it return it seems that the object become empty and then at the add element it crushes. that's the return :
return toAdd;
'toAdd' it's User type. What am I doing wrong?
typedefs is a bad idea; the semantics of pointers are fundamentally different, and hiding that can lead to code that is confusing to read.constin the above makeslineToSplit, the pointer, not what it points to, constant. You probably want it the other way around:char const* lineToSplitorconst char* lineToSplit(they're equivalent).