fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. typedef struct
  4. {
  5. int lmao;
  6. struct ayylmao *nextNode;
  7. }ayylmao;
  8. ayylmao *front, *rear,*temp;
  9. void addVal(int iVal)
  10. {
  11. if(!front)
  12. {
  13. front = calloc(1,sizeof(ayylmao));
  14. rear = front;
  15. (*rear).nextNode = NULL;
  16. }
  17. else
  18. {
  19. (*rear).nextNode = calloc(1,sizeof(ayylmao));
  20. rear = (*rear).nextNode;
  21. }
  22. (*rear).lmao = iVal;
  23. }
  24. void printList(void)
  25. {
  26. temp = front;
  27. while(temp)
  28. {
  29. printf("%d ",(*temp).lmao);
  30. temp = (*temp).nextNode;
  31. }
  32. }
  33. int main(void)
  34. {
  35. addVal(13);
  36. addVal(12);
  37. printList();
  38. return 0;
  39. }
  40.  
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
13 12