I want to quickly make a static linked list, with as little code as possible, which is very readable and without clutter. How do i accomplish this elegantly?
something like
1 -> 2 -> 3 -> 4 -> NULL
struct node {int x; struct node *next;}; #define cons(x,next) (struct node[]){{x,next}} struct node *head = cons(1, cons(2, cons(3, cons(4, NULL))));
1.4m articles
1.4m replys
5 comments
57.0k users