banan-os/userspace/test.c

36 lines
496 B
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
#define N 1024
2023-04-12 22:20:18 +03:00
int main()
{
for (int i = 0; i <= 10; i++)
{
int** ptrs = malloc(N * sizeof(int*));
if (ptrs == NULL)
{
perror("malloc");
return 1;
}
for (int j = 0; j < N; j++)
2023-04-25 14:50:26 +03:00
{
ptrs[j] = malloc(sizeof(int));
if (ptrs[j] == NULL)
{
perror("malloc");
return 1;
}
*ptrs[j] = j;
putchar('0' + *ptrs[j] % 10);
2023-04-25 14:50:26 +03:00
}
putchar('\n');
for (int j = 0; j < N; j++)
free(ptrs[j]);
free(ptrs);
2023-04-25 14:50:26 +03:00
}
2023-04-12 22:20:18 +03:00
return 0;
}