Assigning address of multidimensional array to pointer

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 32-bit PIC MCUs
Post Reply
Author
Message
vojkob
Posts: 11
Joined: 04 Feb 2013 07:50

Assigning address of multidimensional array to pointer

#1 Post by vojkob » 24 Oct 2017 19:29

Dear All,

I have strange problem on MikroC for PIC32:

Entire software is written with multidimensional arrays used for multilanguage display messages.

The typical definition of array in FLASH memory looks like:


const char ParametersSelectMessages[4][3][16]=
{
{
"Standard:",
"Advanced:",
"GSM PIN:"
}
};

meaning I access message with first index for language, with second I access message in selected language, and last one is the string itself. For cleariness, I show just one language entry.

So I can access desired message with

Button34.Caption = &ParametersSelectMessages[0][2]; or Button34.Caption = &ParametersSelectMessages[0][2][0];

and in most of the software this is actually working.

In some of the functions, this does not work anymore, the assigment of array element to Button34.Caption (which is actually pointer to char) is not working and I found wrong addresses in the pointer. The only address that is valid is of 0,0,0, element, all others are shifted like if the compiler is wrongly interpreting the array arichmetics.

I tried all kind of syntax variants, use of separate pointers etc, but the result is the same. In all other software modules, the above aproach is working perfectly.




Any idea,

Regards,
Vojko

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Assigning address of multidimensional array to pointer

#2 Post by filip » 06 Dec 2017 16:24

Hi,

I apologize for the delayed reply.

Is it possible that you isolate this issue in a compact project, so I can reproduce it ?

Regards,
Filip.

Post Reply

Return to “PIC32 PRO Compilers”