Home | History | Annotate | Download | only in data
      1 void testStruct() {
      2     struct str {
      3         float x;
      4         float y;
      5     };
      6 
      7     struct str base;
      8     int index = 0;
      9 
     10     base.x = 10.0;
     11     struct str *s = &base;
     12 
     13     float *v = &(*s).x;
     14     float *v2 = &s[index].x;
     15     printf("testStruct: %g %g %g\n",base.x, *v, *v2);
     16 }
     17 
     18 void testArray() {
     19     int a[2];
     20     a[0] = 1;
     21     a[1] = 2;
     22     int* p = &a[0];
     23     int* p2 = a;
     24     printf("testArray: %d %d %d\n", a[0], *p, *p2);
     25 }
     26 
     27 int main() {
     28     testStruct();
     29     testArray();
     30     return 0;
     31 }
     32