Why does
static char *opcode_str[] = { "DATA"
, "DATA_REQUEST_ACK"
, "ACK_TIMER_EXPIRED"
, "ACK_UNEXPECTED_SEQ"
, "ACK_AS_REQUESTED"
} ;
work, but
static char **opcode_str = { "DATA"
, "DATA_REQUEST_ACK"
, "ACK_TIMER_EXPIRED"
, "ACK_UNEXPECTED_SEQ"
, "ACK_AS_REQUESTED"
} ;
fails with SEGV when opcode_str[0] is printf'd?
I think it's because the second listing has not allocated memory for the five element array of pointers, but I need a more comprehensive explanation.
All the best,
Chris.