Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

c multiple types question

  • 01-12-2003 06:36PM
    #1
    Registered Users, Registered Users 2 Posts: 1,340 ✭✭✭


    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, Registered Users 2 Posts: 707 ✭✭✭d4r3n


    typedef short int alltypes;


  • Registered Users, Registered Users 2 Posts: 1,340 ✭✭✭tw0nk


    ok cool thanks, exactly what i was looking for


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


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


Advertisement