boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

096-fwd-struct.c (469B)


      1 /* Forward struct declaration: struct Node; then struct Node *next inside
      2  * the actual definition. CC.md §Types: forward declarations supported. */
      3 
      4 struct Node;
      5 
      6 struct Node {
      7     int v;
      8     struct Node *next;
      9 };
     10 
     11 int main(int argc, char **argv) {
     12     struct Node tail = { 2, 0 };
     13     struct Node head;
     14     head.v = 1;
     15     head.next = &tail;
     16     if (head.v != 1) return 1;
     17     if (head.next->v != 2) return 2;
     18     if (head.next->next != 0) return 3;
     19     return 0;
     20 }