#include <stdio.h>
#include <stdlib.h>
#define COUNT 3
typedef int (*Mystype)[COUNT];
Mystype yourfunction(int n)
{
Mystype p;
int i = 0, j = 0;
if (NULL==(p = (Mystype)malloc(n*COUNT*sizeof(int))))
{
printf("OVERFLOW!\n");
exit(0);
}
for (; i<n; i++)
{
for (j=0; j<COUNT; j++)
{
p[i][j] = j+1;
}
}
return p;
}
void print_array(Mystype arry, int n)
{
int i = 0, j = 0;
for (; i<n; i++)
{
for (j=0; j<COUNT; j++)
{
printf("%d ",arry[i][j]);
}
printf("\n");
}
}
void main()
{
int n = 4;
Mystype a = yourfunction(n);
print_array(a,n);
}