I dunno if this is what you're trying to do - you keep changing between arrays and pointers.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct foo {
char name[20]; // 20
int a; // 4
int bar[][3]; // 12*n
};
int main()
{
struct foo *jobber;
size_t alloc;
int i, j;
printf( "%u\n", sizeof *jobber );
printf( "%u\n", sizeof jobber->a );
printf( "%u\n", sizeof jobber->bar[0] );
// put a bar[10][3] at the end of the structure
alloc = sizeof *jobber + sizeof jobber->bar[0] * 10;
printf( "allocating %u bytes\n", alloc );
jobber = malloc( alloc );
strcpy( jobber->name, "hello" );
jobber->a = 123;
for ( i = 0 ; i < 10 ; i++ ) {
for ( j = 0 ; j < 3 ; j++ ) {
jobber->bar[i][j] = i * j;
}
}
return 0;
}