Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

c multiple types question

Options
  • 01-12-2003 6:36pm
    #1
    Registered Users Posts: 1,361 ✭✭✭


    hey everyone,

    I have a project that requires me to define a type that contains members of all built in types eg int, short etc, then I have to use this type and store it in a stack.

    I am new to c and my question is, what is the syntax to create a type made up of lots of different types, for instance to call the type "alltypes" and have it made up of int short float etc?

    thanks a million


Comments

  • Registered Users Posts: 707 ✭✭✭d4r3n


    typedef short int alltypes;


  • Registered Users Posts: 1,361 ✭✭✭tw0nk


    ok cool thanks, exactly what i was looking for


  • Registered Users Posts: 2,281 ✭✭✭DeadBankClerk


    typedef struct _alltypes
    {
    char c;
    short s;
    int i;
    float f,
    double d;
    bool b;
    } alltypes;


Advertisement