Advertisement

07.04.2008 at 08:54AM PDT, ID: 23539668
[x]
Attachment Details

C (not c++) 2 structures referencing each other. possible?

Asked by ciuly in C Programming Language

Hi,

I have 2 structers which map to some data that can reference one another.

basically, I start with a list of boxes. and each box can contain 0 or more boxes (the count is the immediat child and not the total inner boxes of all boxes)

how can I define the structures so that it compiles and it's usable? if this is not possible, how can I define my datatype (list of boxes and each box contains list of boxes)?

Example:Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
typedef struct TBox{
  int color;
  int size;
  Boxes* boxes;
} Box;
 
typedef struct TBoxes{
  int count;
  Box* boxes;
} Boxes;
[+][-]07.04.2008 at 09:07AM PDT, ID: 21933767

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.04.2008 at 09:38AM PDT, ID: 21933917

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 09:41AM PDT, ID: 21933929

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.04.2008 at 09:46AM PDT, ID: 21933947

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 09:52AM PDT, ID: 21933971

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 09:57AM PDT, ID: 21933984

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 09:59AM PDT, ID: 21933989

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.04.2008 at 10:00AM PDT, ID: 21933994

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906