I figured it out: i just need to define the instance of the struct I want to use as a member of the other struct, and use the -> operator to distinguish which object I am extracting which property from...



[original question] When defining one struct as a pointer within another, how does one assign values to the variables and pointers within the child struct? The manual suggests I can use pointers to structs when defining structs.

Code:
typedef struct {
var a;
var b;
var c;
} CHILD;

typedef struct {
struct CHILD* ch_struct; //the manual suggests I can do this
} PARENT;

PARENT parent_struct {
//can I set ch_struct.a here? Or does ch_struct already need to be defined?
}




Last edited by deianthropus; 07/29/10 21:15.