I am new to C and I was wondering if there is an order of elements in the structure.
I have the following structure:
struct list
{
struct list_el *head;
int size;
}
I use this to create a linked list. The head points to the first element, and the size indicates the number of elements in the list.
I also have the following function to initialize a list.
typedef struct list list;
list* list_init()
{
list *list = malloc(sizeof(list));
if(list)
{
list->head = NULL;
list->size = 0;
return list;
}
return NULL;
}
, - , , valgrind, , 4 list_init(), 0 list->size. / , . . , ( size , head), , NULL head, size . - , ?
: , , , C. , .