Initializing a pointer at declaration time in a C struct

Viewed 132

Is there a way to initialize a pointer in a C struct at declaration time:

struct person
{
  uint8_t age;
  uint16_t * datablock;
} mike = { 2, malloc(4) };

I've tried the code above, but I get:

initializer element is not constant for the datablock member.

I'm using GCC.

1 Answers
Related