I need to create a simple linked list, with 16 elements.
The struct is:
struct processo {
int pid;
struct processo *prox;
};
I need to create a list, with a pointer poiting to the first element, and the elements have the values 0-15.
How do I create the list?
I have to use malloc to allocate all the elements, with a for?
I tried to do this without malloc, and it doesn't work.
When I try to access the first element, it returns not the value 0, that it sould...
Can someone help me with the creation of this list?
thank you.
Rolf
The struct is:
struct processo {
int pid;
struct processo *prox;
};
I need to create a list, with a pointer poiting to the first element, and the elements have the values 0-15.
How do I create the list?
I have to use malloc to allocate all the elements, with a for?
I tried to do this without malloc, and it doesn't work.
When I try to access the first element, it returns not the value 0, that it sould...
Can someone help me with the creation of this list?
thank you.
Rolf