I'm trying to get a struct to malloc (one time its size) this is the code:
isn't this the right way?Code:#include <stdio.h>
#include <stdlib.h>
#define MAX_STRING 128
typedef char String[MAX_STRING];
typedef struct {
String Name;
double Size;
} ArrayType;
typedef ArrayType Array[];
int main(void) {
Array = malloc(sizeof(*Array));
}
Also, i cant figure out how to realloc the array.
I would really appreciate any help.