динамическое выделение mem

This commit is contained in:
Kolan Sh 2011-04-30 00:35:53 +04:00
parent 3f1e00dd1e
commit 1a34fea5ff
1 changed files with 4 additions and 2 deletions

View File

@ -93,14 +93,14 @@ inline void pool_free(void *p)
busy_pool = b2; busy_pool = b2;
} }
void *mem[MAX_I];
int main() int main()
{ {
unsigned long long i; unsigned long long i;
init(); init();
void **mem = malloc(MAX_I * sizeof(void *));
for (i = 0; i < MAX_I; i++) for (i = 0; i < MAX_I; i++)
if (!(mem[i] = pool_alloc())) { if (!(mem[i] = pool_alloc())) {
@ -111,6 +111,8 @@ int main()
for (i = 0; i < MAX_I; i++) for (i = 0; i < MAX_I; i++)
pool_free(mem[i]); pool_free(mem[i]);
free(mem);
return 0; return 0;
} }