| 
	
	|  |  |  
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| Wizard 
 
 
 Joined: 27 Mar 2006
 Posts: 9
 
 
 
			        
 
 | 
			
				| Problem declaring a pointer |  
				|  Posted: Wed Mar 29, 2006 4:22 pm |   |  
				| 
 |  
				| 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
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Wed Mar 29, 2006 4:37 pm |   |  
				| 
 |  
				| 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);
 }
 | 
 |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |