I have this structure :
typedef struct xmlelem{
Char *Element_name;
Char *Element_Text;
pAttr_Element attr_arr[M];
Xml_Element *parent;
Xml_Element *children[N];
Int depth;
Int num_of_children;
Int num_of_attr;
}Xml_Element,*pXml_Element
I was wondering about the children and the attr_arr .
For the attr_arr – is it a pointer to an array where every cell is from type pAttr_Element or from type attr_Element ? How can I figure out if the cell is a pointer or the structure itself? How can I define both of them? I’m kind of lost..
sorry – here is the pAttr_Element:
typedef struct {
char *name;
char *value;
}Attr_Element,*pAttr_Element
another editing ,trying to be clearer
I understood thanks to the guys here that this is an array,where each cell is a pointer of type pAttr_Element.
I also understand now that declaring : Attr_Element[10] is an array where each cell is type of my structure
the only thing missing is how I define a pointer to an array where each cell is from type Attr_Element ? and not a pointer
Thanks!
Here I have assumed
attr_Elementis structure andpAttr_Elementis typedef for type of pointer to this structure.typdef atr_Element* pAttr_Element;In this case,
pAttr_Element attr_arr[M];each element of attr_arr is a pointer variable toattr_Element. That meansattr_arris a array of pointer of typeattr_ElementIf you want to define array of elements of type
attr_Element, directly use that type as below