View Single Post
  #2   Spotlight this post!  
Unread 10-02-2005, 23:12
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: If statement in .h file or Indirect addressing? Kevin NAV code...

You want the struct you use to be one of a predefined set, that is selected at the beginning of runtime? You could try a big switch() statement that would contain assignment statements.
Code:
struct commands mycommand;
switch(input)
{
  case 1:
    mycommand = {...};
    break;
  case 2:
    ..... repeat
}
Not sure if I have the syntax right - it's late, and I haven't used structs in a while.

I wouldn't use a pointer to an array element because you'd be allocating space for structs that would not be used - you wouldn't switch modes after starting the process.