OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [lcc/] [tst/] [array.c] - Blame information for rev 262

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 hellwig
int x[3][4], *y[3];
2
 
3
main() {
4
        int z[3][4];
5
        int i, j, *p;
6
 
7
        for (i = 0; i < 3; i++) {
8
                for (j = 0; j < 4; j++)
9
                        x[i][j] = 1000*i + j;
10
                y[i] = x[i];
11
        }
12
        f();
13
        for (i = 0; i < 3; i++) {
14
                y[i] = p = &z[i][0];
15
                for (j = 0; j < 4; j++)
16
                        p[j] = x[i][j];
17
        }
18
        g(z, y);
19
        return 0;
20
}
21
 
22
f() {
23
        int i, j;
24
 
25
        for (i = 0; i < 3; i++)
26
                for (j = 0; j < 4; j++)
27
                        printf(" %d", x[i][j]);
28
        printf("\n");
29
        for (i = 0; i < 3; i++)
30
                for (j = 0; j < 4; j++)
31
                        printf(" %d", y[i][j]);
32
        printf("\n");
33
}
34
 
35
g(x, y)
36
int x[][4], *y[];
37
{
38
        int i, j;
39
 
40
        for (i = 0; i < 3; i++)
41
                for (j = 0; j < 4; j++)
42
                        printf(" %d", x[i][j]);
43
        printf("\n");
44
        for (i = 0; i < 3; i++)
45
                for (j = 0; j < 4; j++)
46
                        printf(" %d", y[i][j]);
47
        printf("\n");
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.