I'm having a hard time trying to understand what's wrong in my piece of code,
As you can see, it's a linked list and it's supposed to connect "Boxes", each Box has a int value and a pointer to the next Box, however I'm not being able to make it run and I don't know why.
Can anyone tell me why it's not running?
#include <stdio.h>
#include <stdlib.h>
struct node {
int n;
struct node *next;
} node;
typedef struct node Box;
main()
{
Box *q, *r, *s;
Box t;
q = (Box *)malloc(sizeof(Box));
r = (Box *)malloc(sizeof(Box));
s = (Box *)malloc(sizeof(Box));
q->n = 2;
q->next->n = 3;
r->n = 4;
q->next->next = r;
r->next = NULL;
s->n = 5;
s->next = NULL;
t.n = 6;
printf("================");
printf("Q == %d\n", q->n);
printf("R == %d\n", r->n);
printf("S == %d\n", s->n);
printf("{%d}{%d}{%d}{%d}{%d}", q->n, q->next->n, r->n, s->n, t.n);
}