main
test-branch
| Line | |
|---|
| 1 | #include<mem.cvh>
|
|---|
| 2 | #include<stdlib.h>
|
|---|
| 3 | #include<pointer.cvh>
|
|---|
| 4 |
|
|---|
| 5 | struct T {
|
|---|
| 6 | int (*x)[100];
|
|---|
| 7 | } ** a;
|
|---|
| 8 |
|
|---|
| 9 | int main() {
|
|---|
| 10 | a = (struct T **)malloc(sizeof(struct T*));
|
|---|
| 11 | *a = (struct T*)malloc(sizeof(struct T));
|
|---|
| 12 | (*a)->x = (int (*)[100])malloc(sizeof(int[100]) * 10);
|
|---|
| 13 |
|
|---|
| 14 | $mem m = (*a)->x;
|
|---|
| 15 |
|
|---|
| 16 | m = &(*a)->x[0][0 .. 10];
|
|---|
| 17 | m = *a;
|
|---|
| 18 | m = &(*a)->x;
|
|---|
| 19 | $assert($equals(&m, &m));
|
|---|
| 20 | free((*a)->x);
|
|---|
| 21 | free(*a);
|
|---|
| 22 | free(a);
|
|---|
| 23 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.