それと、何か突っ込みどころがあったらどんどん突っ込んでください。
コンパイラはbccです。
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int n;
} Test;
void func(Test ***a)
{
Test b;
scanf("%d", &b.n);
*a = (Test **)realloc(*a, sizeof(Test *) * (5 + 1));
*a[5] = &b;
printf("\n%d\n", (*a[5])->n);
}
int main(void)
{
int i;
Test **a;
a = (Test **)malloc(sizeof(Test *) * 5);
for(i = 0; i < 5; ++i){
a[i] = (Test *)malloc(sizeof(Test));
a[i]->n = i * 2;
}
for(i = 0; i < 5; ++i){
printf("%d\n", a[i]->n);
}
func(&a);
for(i = 0; i < 6; ++i){
printf("%d\n", a[i]->n);
}
return 0;
}