fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct list {
  5. int key;
  6. struct list *next;
  7. };
  8.  
  9. struct list *append(struct list **l1, int k)
  10. {
  11. *l1 = malloc(sizeof *l1);
  12. (*l1)->key = k;
  13. return *l1;
  14. }
  15.  
  16. int main(void)
  17. {
  18. struct list *p, *l1, l2 = { 42, NULL }, l3 = { 24, NULL };
  19. int i;
  20.  
  21. for (p = l1, i = 0; i < 42; ++i)
  22. p = append(&p, i);
  23.  
  24. for (struct list *p = l1; p != NULL; p = p->next)
  25. printf("%d\n", p->key);
  26. }
  27.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
cc1: warnings being treated as errors
prog.c: In function ‘main’:
prog.c:18: error: unused variable ‘l3’
prog.c:18: error: unused variable ‘l2’
stdout
Standard output is empty