Accessing structures contained in structures

This is a discussion on Accessing structures contained in structures within the C Programming forums, part of the General Programming Boards category; Given the following:
struct year{
int month;
int day;
int year;
};
struct person{
char fname[15];
char lname[15];
struct year ...

>Would you be able to allocate memory using the following:
Yes, but a better way would be:
start = malloc ( sizeof *start );

>Will this include memory for the year structure contained in the person structure?
Yes.

>Would you be able to access a member of birthday with the following:
Yes.

>("%s", current->birthday.year);
Is this a call to scanf? Because birthday.year is an int and you are trying to read a string into it. Try this to get rid of the bug:
scanf ( "%d", &start->birthday.year );