1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00
cc65/test/ref/array.c

63 lines
1.3 KiB
C
Raw Normal View History

2014-09-24 14:45:10 +00:00
/*
!!DESCRIPTION!! basic array properties
!!ORIGIN!! LCC 4.1 Testsuite
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
*/
#include <stdio.h>
#ifndef NO_NEW_PROTOTYPES_FOR_OLD_FUNC_DECL
int f(void);
int g(int x[][4],int *y[]);
#endif
int x[3][4], *y[3];
main() {
2019-02-12 21:50:49 +00:00
int z[3][4];
int i, j, *p;
for (i = 0; i < 3; i++) {
for (j = 0; j < 4; j++)
x[i][j] = 1000*i + j;
y[i] = x[i];
}
f();
for (i = 0; i < 3; i++) {
y[i] = p = &z[i][0];
for (j = 0; j < 4; j++)
p[j] = x[i][j];
}
g(z, y);
2022-04-17 14:07:52 +00:00
2019-02-12 21:50:49 +00:00
return 0;
2014-09-24 14:45:10 +00:00
}
f() {
2019-02-12 21:50:49 +00:00
int i, j;
for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++)
printf(" %d", x[i][j]);
printf("\n");
for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++)
printf(" %d", y[i][j]);
printf("\n");
2014-09-24 14:45:10 +00:00
}
g(x, y)
int x[][4], *y[];
{
2019-02-12 21:50:49 +00:00
int i, j;
for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++)
printf(" %d", x[i][j]);
printf("\n");
for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++)
printf(" %d", y[i][j]);
printf("\n");
2014-09-24 14:45:10 +00:00
}