aboutsummaryrefslogtreecommitdiff
path: root/gcc/cil/tests/s1.c
blob: 5b467399bd6c30f1db52770d0fae5d510d10bf3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * This example tests operations on elements of type struct.
 */
#include <stdio.h>


typedef struct {
    int    a;
    long long d;
} foo;

static void
p (foo *f)
{
    printf ("%d %lld\n", f->a, f->d);  
}

int main()
{
    int one = 1;
    int three = 3;
    foo f[3] = {{one, 2}, {three, 4}, {5, 6}};

    p(&f[0]);
    p(&f[1]);
    p(&f[2]);

    /*printf ("&one = %p\n&three = %p\n&f = %p\n", &one, &three, &f);*/
    printf ("sizeof (one) = %d\nsizeof (three) = %d\nsizeof (f) = %d\n", (int) sizeof (one), (int) sizeof (three), (int) sizeof (f));

#if 0
    f[0] = f[1];

    p(&f[0]);
    p(&f[1]);
    p(&f[2]);
#endif

    return 10;
}