2023-04-22 15:35:32 +03:00
|
|
|
#include <stdio.h>
|
2023-05-06 18:10:38 +03:00
|
|
|
#include <stdlib.h>
|
2023-04-22 15:35:32 +03:00
|
|
|
|
2023-05-07 23:57:01 +03:00
|
|
|
#define N 512
|
|
|
|
|
2023-04-12 22:20:18 +03:00
|
|
|
int main()
|
|
|
|
{
|
2023-05-07 23:57:01 +03:00
|
|
|
for (int i = 0; i <= 10; i++)
|
2023-05-06 18:10:38 +03:00
|
|
|
{
|
2023-05-07 23:57:01 +03:00
|
|
|
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
|
|
|
{
|
2023-05-07 23:57:01 +03:00
|
|
|
ptrs[j] = malloc(sizeof(int));
|
2023-05-07 01:21:50 +03:00
|
|
|
if (ptrs[j] == NULL)
|
|
|
|
{
|
|
|
|
perror("malloc");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
*ptrs[j] = j;
|
2023-05-07 23:57:01 +03:00
|
|
|
putchar('0' + *ptrs[j] % 10);
|
2023-04-25 14:50:26 +03:00
|
|
|
}
|
2023-05-07 23:57:01 +03:00
|
|
|
putchar('\n');
|
|
|
|
|
|
|
|
for (int j = 0; j < N; j++)
|
2023-05-07 01:21:50 +03:00
|
|
|
free(ptrs[j]);
|
2023-05-07 23:57:01 +03:00
|
|
|
free(ptrs);
|
2023-04-25 14:50:26 +03:00
|
|
|
}
|
2023-05-07 01:21:50 +03:00
|
|
|
|
2023-04-12 22:20:18 +03:00
|
|
|
return 0;
|
|
|
|
}
|