|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
errors with structure pointers |
Posted: Wed Sep 22, 2004 8:23 pm |
|
|
I'm trying to compile the following code using compiler version 3.202. This is a fairly simple set of linked structures, but the compiler keeps choking on it.
Without the extern statements the compiler predictably claims the forward reference structure pointers point to undefined variables.
With the extern statements I get "Identifier already in use in this scope."
How am I suppose to make this type of linked structure setup work?
Also I should be able to have text defined as a char* instead of an array. The compiler should put the string in memory, then insert a pointer in the structure. This does not work either. I have to waste memory with an array instead.
Any assistance would be greatly appreaciated.
cheers,
darryl moore
Code: |
#include <18F6720.h>
typedef struct menu_struct
{
char text[15]; // one line of text to display for this menu
char flags; // characteristics of this menu
int8 *value; // what if any value this menu displays/edits
struct menu_struct *up; // next menu when we scroll up
struct menu_struct *down; // next menu when we scroll down
struct menu_struct *sub; // sub menu to select if we press enter
}menu_t ;
extern menu_t master_menu;
extern menu_t service_menu;
menu_t user_menu =
{
"USER MENU",
0,
0,
0,
&master_menu,
0
};
menu_t master_menu =
{
"MASTER MENU",
0,
0,
&user_menu,
&service_menu,
0//master_main_menu,
};
menu_t service_menu =
{
"SERVICE MENU",
0,
0,
&master_menu,
0,
0//service_main_menu,
};
|
|
|
|
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
|
Posted: Tue Oct 05, 2004 7:01 am |
|
|
Try instead of *pntr, use pntr->struct name _________________ Alex |
|
|
|
|
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
|