banan-os/userspace/test.c

27 lines
376 B
C
Raw Normal View History

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