I have a char array in typedef struct, which is too big (around 260k)
#define LENGTH 260000
typedef struct {
int longSize;
char hello[LENGTH ];
} p_msg;
I would like to use malloc on this char array which as below:
typedef struct {
int longSize;
char * hello= malloc(sizeof(char));
} p_msg;
But it gave me error:
error: expected ':', ',', ';', '}' or '__attribute__' before '=' token
How can I malloc the char array?
malloc(LENGTH)instead ofmalloc(sizeof(char))(forLENGTHchars,sizeof(char)is always 1), though you can't do it in the type definition like that.