Thread: Structure - Typedef accessing problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    eat my shorts!
    Join Date
    Apr 2002
    Posts
    294

    Arrow Structure - Typedef accessing problem

    <<threads merged>>

    Code:
    typedef enum RelationalOperators  {EQ, NE, GT, LT} Rel_Op;
    
    
    typedef union TokenAttribute{
    	Rel_Op rel_op;  
      } TA;
    
    typedef struct Token
    {
    	TA attribute; /* token attribute */
    } Token;

    Code:
    Token temp;
    temp.attribute.rel_op[0];       /*error*/
    I have been trying ti access the rel_op as i need to compare the content...but cant seem to get the syntax right...
    Games Reviews Previews Desktop Themes Downloads Paintball Forums Shareware Freeware and much more

    The best in Technology and Gaming News

    www.back2games.com

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    rel_op isn't an array, and you're trying to use it like one. Maybe you should just use an array instead of an enum?

    Honestly it's a little hard to give advice, since I can't tell what you're really trying to do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 06-04-2009, 02:03 PM
  2. Problem with custom structure
    By stickman in forum C++ Programming
    Replies: 9
    Last Post: 10-14-2006, 02:57 PM
  3. Structure and typedef
    By Roaring_Tiger in forum C Programming
    Replies: 6
    Last Post: 03-12-2003, 08:27 PM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  5. Pointer to structure problem
    By unregistered in forum C Programming
    Replies: 3
    Last Post: 12-24-2001, 07:54 AM