Mail Archives: djgpp/2000/10/31/23:14:07
Tim Nicholson <djgpp_mail AT gizzy DOT co DOT uk> wrote:
> char button_label_array[500][4][11] = { ".....
> In other words there are 500 labels in four languages each up to 10 chars
> long.
> label, in my program is defined as a char pointer and set like so..
> label = &button_label_array[x]; (where x always = 0 to 99).
That's incorrect code, then. &button_label_array[x] is an expression of type
address of (element of (char array [500][4][11])
= address of ( char array [4][11])
= pointer to (char array [11])
This is not compatible to a pointer to a char, so assigning this to a
'label' declared as char pointer is an error.
gcc at full warning level (-O2 -Wall -W) should have complained about
this.
> I pass (*label)[setup->language] to the function.
Here, '*label' is of type 'char', and accessing element number
(setup->language) of it is not going to do what you thought it does.
You have to define 'label' as pointer to a char[11] array:
char (*label)[11];
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -