source:
CIVL/mods/dev.civl.abc/examples/c/complexStructArray.c
| Last change on this file was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 300 bytes | |
| Line | |
|---|---|
| 1 | #include<stdlib.h> |
| 2 | #include<assert.h> |
| 3 | |
| 4 | int main() { |
| 5 | struct T { |
| 6 | int (*x)[10]; |
| 7 | } ** a; |
| 8 | |
| 9 | a = (struct T **)malloc(sizeof(struct T *)); |
| 10 | a[0] = (struct T *)malloc(sizeof(struct T)); |
| 11 | a[0][0].x = (int (*)[10])malloc(sizeof(int[10])); |
| 12 | a[0][0].x[0][0] = 9; |
| 13 | |
| 14 | assert(a[0][0].x[0][0] == 9); |
| 15 | } |
Note:
See TracBrowser
for help on using the repository browser.
