Mulitdimensional Array of Consts

Guys,

I am trying to define a multi-dimensional array of constants.

const unsigned char chksum[8][3] = { 0x03, 0xFE, 0x3F, 0x65, 0x72, 0xA2, 0xF7, 0x72, 0x56, 0xB0, 0xC2, 0x2F, 0x3B, 0xF4, 0x59, 0x8B, 0x52, 0xAA, 0xB0, 0x31, 0xA9, 0xDD, 0xE3, 0x08}; 

However when I try to compile this, the complier gives me an error,

Error: const const unsigned char: unknown type

That’s not the exact error but its close, can anybody explain why this happens and/or how to correct it?

Thanks,

Joe

You must be using a slightly different version of gcc. In mine the error message is clearer:

x.c:1: warning: missing braces around initializer
x.c:1: warning: (near initialization for ‘chksum[0]’)

What you need to initialise a multidimensional array are nested initialisers that reflect the shape of the array.

const unsigned char chksum[8][3] = {
 { 0x03, 0xFE, 0x3F},
 ...
};