Try this.
Code:
#include <stddef.h>
#include <stdlib.h>
struct Abc {
int *x ;
} ;
int main(void) {
struct Abc **st = malloc( 2 * sizeof(*st) ) ;
st[0] = (struct Abc*)malloc(sizeof(**st) ) ;
st[1] = (struct Abc*)malloc(sizeof(**st) ) ;
return 0;
}
That creates an array of arrays with an Abc**.
You can also do this.
Code:
#include <stddef.h>
#include <stdlib.h>
struct Abc {
int *x ;
} ;
int main(void) {
struct Abc *st = malloc( 2 * sizeof(*st) ) ;
return 0;
}
Then st[0] is one element, and st[1] is another element. It's just that I've created an array of structures, not an array of pointers to dynamically allocated structures.