Array of pointers

From NuclearCat's homepage

Jump to: navigation, search

Not sure if it is right.

struct testarr {
 int a;
 int b;
} **macarr;

/* Allocate memory for pointers array */
macarr=malloc(sizeof(struct testarr*)*HOW_MUCH_POINTERS);

/* Allocate memory for structures */
macarr[0] = malloc(sizeof(struct testarr));
macarr[1] = malloc(sizeof(struct testarr));
Personal tools