Hi guys, im stuck with this linked list problem, i just want to make 3 nodes all with values in them declared in main and just print out its values, but im confused on how to link them together especially with the *head and *tail.
I can implement it with out the *head and *tail pointers but with them included its more confusing!
thanks
Code:
#include <stdio.h>
typedef int data_t;
typedef struct node node_t;
struct node {
data_t data;
node_t *next;
};
typedef struct {
node_t *head;
node_t *tail;
} sequence_t;
void print_list( sequence_t * );
int main( void )
{
sequence_t nodes;
node_t num1, num2, num3, *start;
num1.data = 2;
num2.data = 10;
num3.data = 20;
return 0;
}
void print_list( sequence_t *seq )
{
while ( print != NULL ) {
printf( "head: %d\n", seq->head->data );
}
seq=seq->head->next;
}