I'm beggining to work on a project for school which consists in creating a program for managing the pacients and doctors of a clinic.Doctors would have their personal data(name,age,address,speciality,number of pacients treated,etc.) and pacients would have(name,age,adress,number of visits to the clinic,date of visits to the clinic,etc.)
After searching and reading a bit about structures,still I'm not very clear with them in terms of data variables or organization.
First,I thought on organizing the structures as following,by creating two structures:
But then I thought,why would I repeat the variables name and age and address if both Pacients and Doctors use themand instead add them in another structure?So I thought in creating another structure that could hold those variables making them more generic:Code:struct Doctors { char speciality[15]; int nptreated; }; struct Pacients { int nvisits; };
So,in spite of thinking that the later solution looks best,what is your opinion?Anything that could help me clear this out and the overall concept of structures would be helpful!Thanks in advance!Code:struct Person { char name[20]; int age; char address[50]; struct Pacients p; struct Doctors d; };