C Struct trouble
Below is some code I created to try to get a better understanding of how C uses structs. As you might guess, I am not getting my desired results. What I don't understand is how to access a struct within a struct AND I don't know what this code is actually doing.


#include <stdio.h>

struct card 
{
	unsigned int value;
	unsigned int suit;
};


struct board
{
	struct card deck[52];
};


int main()
{
	struct board b;
	b.deck[0].value = 3;
	b.deck[0].suit = 4;
	
	printf("Card Value: %d Suit: %d \n", b.deck[0].value, b.deck[0].suit);
	
	return 0;
}

C Struct trouble
===

Below is some code I created to try to get a better understanding of how C uses structs. As you might guess, I am not getting my desired results. What I don't understand is how to access a struct within a struct AND I don't know what this code is actually doing.


#include <stdio.h>

struct card 
{
	unsigned int value;
	unsigned int suit;
};


struct board
{
	struct card deck[52];
};


int main()
{
	struct board b;
	b.deck[0].value = 3;
	b.deck[0].suit = 4;
	
	printf("Card Value: %d Suit: %d \n", b.deck[0].value, b.deck[0].suit);
	
	return 0;
}
