Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to declare extern 2d-array in header?

We have this declaration in LCD.c:

unsigned char LCD[8][64] = {((unsigned char) 0)};

And in LCD.h we want to have something like:

extern unsigned char LCD[][];

We get this error:

Error[Pe098]: an array may not have elements of this type
like image 801
user1106072 Avatar asked Dec 20 '11 20:12

user1106072


1 Answers

You need, at a minimum, to include the right-most column size for a 2-D array. You can declare it like this:

extern unsigned char LCD[][64];

Otherwise the compiler would not be able to compute the offset after the first row.

like image 157
Mark Wilkins Avatar answered Sep 21 '22 14:09

Mark Wilkins