Skip to content

Instantly share code, notes, and snippets.

@ox
Last active December 13, 2015 23:19
Show Gist options
  • Save ox/4990617 to your computer and use it in GitHub Desktop.
Save ox/4990617 to your computer and use it in GitHub Desktop.
#define number_of_structs 100;
struct test {
int a;
int b;
};
int i;
struct test tests[number_of_structs];
for (i = 0; i < number_of_structs; i++) {
struct test * temp_test = malloc(sizeof(struct test));
temp_test->a = 0;
temp_test->b = 0;
tests[i] = temp_test;
}
for (i = 0; i < number_of_struct; i++) {
free(tests[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment