|
|
View previous topic :: View next topic |
Author |
Message |
Georg Prinz
Joined: 07 Jan 2004 Posts: 22 Location: Frankfurt, Germany
|
Two dimensional array |
Posted: Tue Mar 08, 2005 2:42 pm |
|
|
Hi folks,
can anybody reveal me how to initialize an two dimensional array?
For a menu-driven application i like to store all the text-strings into such an array and retrieve it via the first dimension as follows:
static constant char text[][] = {1,2,3,4,5...},{"Hello","Welcome","Wait",
"Your Code","...",....};
Butjavascript:emoticon('') the compiler does not like it and the manual does not say anything about it.
Therefore i am asking for your help.
Saludos
Jorge _________________ dl 2 kp |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 08, 2005 3:00 pm |
|
|
If you have a question about compiler behavior, the easiest way
to answer it is to write a test program and examine the .LST file
or look in the Program Memory window in MPLAB. Example
of two dimensional array in ROM:
Code: | #include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
const char messages[5][10] = {"Hello", "ABC", "12345", "World", "Today"};
//============================
main()
{
char c;
char i;
char j;
c = messages[i][j];
while(1);
} |
|
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Mar 08, 2005 3:42 pm |
|
|
Looks like you are wanting pointers to consts again. Remember that they are not supported for this compiler. |
|
|
Guest
|
two dim array |
Posted: Wed Mar 09, 2005 2:12 am |
|
|
Hi Mark,
thanks for reply. No, this is what I learned already. It was the way how to initialize the two dimensions. Through your example it is clear now. Unfortunately the manual was not very helpful.
Saludos
Jorge |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|