Pointers and nested structures
- From: "Computer Wizard" <asaivineetp@xxxxxxxxx>
- Date: 28 Nov 2006 00:14:48 -0800
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 to
deal such thing in pointers.
Thanks!!!
.
- Follow-Ups:
- Re: Pointers and nested structures
- From: mark_bluemel
- Re: Pointers and nested structures
- From: santosh
- Re: Pointers and nested structures
- From: Miles Davis
- Re: Pointers and nested structures
- From: Miles Davis
- Re: Pointers and nested structures
- Prev by Date: Re: Macros
- Next by Date: Re: Sharing static variables or function between source files.
- Previous by thread: Macros
- Next by thread: Re: Pointers and nested structures
- Index(es):