i don't really understand this piece of code:
Liste *initialisation()
{
Liste *liste = malloc(sizeof(*liste));
Element *element = malloc(sizeof(*element));
if (liste == NULL || element == NULL)
{
exit(EXIT_FAILURE);
}
element->number = 0;
element->next = NULL;
liste->first = element;
return liste;
}
"Liste" is a structure, and "Element" too. This code has been wrote before the one upper, too:
typedef struct Element Element;
struct Element
{
int number;
Element *next;
};
typedef struct Liste Liste;
struct Liste
{
Element *first;
};
I don't understand the 1st, 3rd and 4th lines of the function. All of this is written in C, please explain to me why do we have to allocate memory for what seems to be a pointer to me, and why the function has this "*" symbol at the start of its name (i don't remember how is called this * symbol)