Thread: An ADT as an array.

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    26

    An ADT as an array.

    Hey hey,

    I'm wanting to create an ADT that is an array (52 in size) of another ADT structure. The other ADT structure is a card and the array i am trying to create is the deck of cards. However this deck array has to be an ADT. Is this possible to create this ADT array? Could someone point me in the direction of knowing how to do this? Would be much appreciated.

    I hope this makes sence, am very tired and am having trouble thinking.

    Thanks
    -Nick

    edit:
    this is the definition for the card ADT
    Code:
    typedef struct
    {
       enum card_facevalue value;
       enum card_suit suit;
       int card_up;  /*boolean*/
    }card;
    Last edited by Rad_Turnip; 09-19-2006 at 01:08 PM.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    To create your deck of cards, you would do something like:
    Code:
    card deck[52];
    Or:
    Code:
    struct card deck[52];

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  2. Replies: 7
    Last Post: 11-25-2008, 01:50 AM
  3. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  4. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  5. Help with an Array
    By omalleys in forum C Programming
    Replies: 1
    Last Post: 07-01-2002, 08:31 AM