If I use a list like this:
typedef struct list {
char information[20];
struct list *next;
}
And if I try to pass the information through parameter of a function, for example:
list *createlist(char inf[]) {
list *l = (list*)malloc(sizeof(list));
l->information = inf;
l->next = NULL;
return l;
}
It does not work, the error is
[Error] incompatible types in assignment of 'char*' to 'char [20]'
If i declare information like char *information
and in fuction list *createlist(char *inf)
, in this way it works, but the string is limited to 7 characters. How can I fix this?