Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- // 6 bit structure
- typedef struct pcard
- {
- // don't need negative representation
- unsigned pips: 4; // 4 bits = 0 - 15
- unsigned suits: 2; // 2 bits = 0 - 3
- } pcard;
- int main()
- {
- pcard c;
- /***
- * Suits numerical values
- * 0 - hearts
- * 1 - clubs
- * 2 - spades
- * 3 - diamonds
- ***/
- c.pips = 9;
- c.suits = 2;
- printf("Card pip: %d\n", c.pips);
- printf("Card suits: %d\n", c.suits);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement