fork download
  1. #include <stdio.h>
  2.  
  3. typedef struct dlNode {
  4. const struct dlNode* next, *prev;
  5. void* datum;
  6. } dlNode;
  7.  
  8. const static dlNode tail;
  9.  
  10. const static dlNode head={
  11. .next=&tail,
  12. .prev=NULL,
  13. .datum=NULL
  14. };
  15.  
  16. const static dlNode tail={
  17. .next=NULL,
  18. .prev=&head,
  19. .datum=NULL
  20. };
  21.  
  22. int main(void) {
  23. printf("head = %p\n", (void*)&head);
  24. printf("tail = %p\n", (void*)&tail);
  25. printf("head.next = %p\n", (void*)head.next);
  26. printf("tail.prev = %p\n", (void*)tail.prev);
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
head = 0x2ab9f3244db0
tail = 0x2ab9f3244d90
head.next = 0x2ab9f3244d90
tail.prev = 0x2ab9f3244db0