0

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?

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by cmsc
0

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

Edited by Ancient Dragon: n/a

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.