Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <stdlib.h>
- struct rectangle {
- int x;
- int y;
- int w;
- int h;
- };
- struct container {
- struct rectangle *r;
- bool foo;
- };
- struct application {
- struct container c[10][10];
- bool bar;
- };
- int main(void) {
- int x, y;
- struct application a;
- a.bar = false;
- for (x = 0; x < 10; x++) {
- for (y = 0; y < 10; y++) {
- a.c[x][y].r = malloc(sizeof (struct rectangle));
- if (a.c[x][y].r == NULL) {
- return -1;
- }
- a.c[x][y].r->x = 1;
- a.c[x][y].r->y = 1;
- a.c[x][y].r->w = 1;
- a.c[x][y].r->h = 1;
- a.c[x][y].foo = true;
- }
- }
- for (x = 0; x < 10; x++) {
- for (y = 0; y < 10; y++) {
- free(a.c[x][y].r);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement