Hello,
I am really scrwed up with the following stuff:
struct employee
{
char* employee_name;
};
struct department
{
char* department_name ;
struct employee* emp; //Collection of all employees in a department
};
In main(), I wrote
struct department* company;
I want to first enter the name of department and then names of employees in that department. I tried with pointers but I must hv messed up somewhere n getting segmentation faults. Tried using array representation e.g. company[i].emp[j].employee_name . This also failed. I used new operator but it didn't help. Please tell me how do deal such things in pointers.
Thanks!!!
I am really scrwed up with the following stuff:
struct employee
{
char* employee_name;
};
struct department
{
char* department_name ;
struct employee* emp; //Collection of all employees in a department
};
In main(), I wrote
struct department* company;
I want to first enter the name of department and then names of employees in that department. I tried with pointers but I must hv messed up somewhere n getting segmentation faults. Tried using array representation e.g. company[i].emp[j].employee_name . This also failed. I used new operator but it didn't help. Please tell me how do deal such things in pointers.
Thanks!!!
Comment