2020-09-04 08:44:12 +03:00
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
ASSERT(20, ({ int n=5; int x[n]; sizeof(x); }));
|
|
|
|
ASSERT((5+1)*(8*2)*4, ({ int m=5, n=8; int x[m+1][n*2]; sizeof(x); }));
|
|
|
|
|
|
|
|
ASSERT(8, ({ char n=10; int (*x)[n][n+2]; sizeof(x); }));
|
|
|
|
ASSERT(480, ({ char n=10; int (*x)[n][n+2]; sizeof(*x); }));
|
|
|
|
ASSERT(48, ({ char n=10; int (*x)[n][n+2]; sizeof(**x); }));
|
|
|
|
ASSERT(4, ({ char n=10; int (*x)[n][n+2]; sizeof(***x); }));
|
|
|
|
|
|
|
|
ASSERT(60, ({ char n=3; int x[5][n]; sizeof(x); }));
|
|
|
|
ASSERT(12, ({ char n=3; int x[5][n]; sizeof(*x); }));
|
|
|
|
|
|
|
|
ASSERT(60, ({ char n=3; int x[n][5]; sizeof(x); }));
|
|
|
|
ASSERT(20, ({ char n=3; int x[n][5]; sizeof(*x); }));
|
|
|
|
|
2020-09-03 16:27:13 +03:00
|
|
|
ASSERT(0, ({ int n=10; int x[n+1][n+6]; int *p=x; for (int i = 0; i<sizeof(x)/4; i++) p[i]=i; x[0][0]; }));
|
|
|
|
ASSERT(5, ({ int n=10; int x[n+1][n+6]; int *p=x; for (int i = 0; i<sizeof(x)/4; i++) p[i]=i; x[0][5]; }));
|
|
|
|
ASSERT(5*16+2, ({ int n=10; int x[n+1][n+6]; int *p=x; for (int i = 0; i<sizeof(x)/4; i++) p[i]=i; x[5][2]; }));
|
|
|
|
|
2020-08-25 03:34:41 +03:00
|
|
|
ASSERT(10, ({ int n=5; sizeof(char[2][n]); }));
|
|
|
|
|
2020-09-04 08:44:12 +03:00
|
|
|
printf("OK\n");
|
|
|
|
return 0;
|
|
|
|
}
|