i have this structure :

typedef struct nodetag{
	char *employeeNumber;
	name mName;
	birthday bday;
	char *address;
	char *rank;
	int salary;
	hireDate *hdate;
}*node;		
typedef struct nodetag1{

	char *month;
	char *date;
	char *year;
}birthday;

but I don't know how to access the month in bday. i tried using node1->bday->month but had an error. I malloced using node1 = (node)malloc(sizeof(struct nodetag));

please help, anyone?

why are the members of birthday char* instead of int? But to answer your question

node1->bday.month = malloc(32); // allocate space for 32 characters
strcpy(node1->bday.month,"January");

but if you mande them integers

node1->bday.month = 0; // January

thank you very much! I used string because I have to scan each character from a textfile to get the data I need to use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.