Home
       0165-struct.c - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
       0165-struct.c (411B)
       ---
            1 struct S1 {
            2         int a;
            3         int b;
            4 };
            5 struct S2 {
            6         struct S1 s1;
            7         struct S1 *ps1;
            8         int arr[2];
            9 };
           10 struct S1 gs1 = {.a = 1, 2};
           11 struct S2 *s = &(struct S2) {
           12         {.b = 2, .a = 1},
           13         &gs1,
           14         {[0] = 1,  1+1}
           15 };
           16 
           17 int
           18 main()
           19 {
           20         if(s->s1.a != 1)
           21                 return 1;
           22         if(s->s1.b != 2)
           23                 return 2;
           24         if(s->ps1->a != 1)
           25                 return 3;
           26         if(s->ps1->b != 2)
           27                 return 4;
           28         if(s->arr[0] != 1)
           29                 return 5;
           30         if(s->arr[1] != 2)
           31                 return 6;
           32         return 0;
           33 }