CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem declaring a pointer

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Wizard



Joined: 27 Mar 2006
Posts: 9

View user's profile Send private message Send e-mail MSN Messenger

Problem declaring a pointer
PostPosted: Wed Mar 29, 2006 4:22 pm     Reply with quote

I have no idea why I can't compile the following var declaration, I'm going to use it to display a menu in a LCD.
Code:

char *menu[]=
{
   " Start/Stop  Sample",
   "Show  Atmosph. Temp.",
   "Show  Corporal Temp.",
   "  Sample Settings",
   "  System Settings"
};

I got the "Expect }" error from the compiler, the compiler stuck after ...Sample",
Any ideas? I would say that the C sintax it's rather than correct.
Does someone know a equivalent code which will compile?
I have planed to use the var like this:
Code:

lcd_gotoxy(1,(i+1));
print_lcd(menu[command]);

Thanks,
_________________
Tomas L.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 29, 2006 4:37 pm     Reply with quote

The program shown below has the following output:
Code:

Start/Stop  Sample

Show  Atmosph. Temp.

Show  Corporal Temp.

  Sample Settings   

  System Settings   


Code:
#include <18F452.h>
#fuses XT,NOWDT,PUT,BROWNOUT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

char *menu[5][21]=
{
  {" Start/Stop  Sample "},
  {"Show  Atmosph. Temp."},
  {"Show  Corporal Temp."},
  {"  Sample Settings   "},
  {"  System Settings   "}
};

//============================
void main()
{
int8 i;

for(i = 0; i < 5; i++)
    printf("%s\n\r", menu[i]);

while(1);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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