Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:46:56+00:00 2026-06-08T15:46:56+00:00

I have this structure : typedef struct xmlelem{ Char *Element_name; Char *Element_Text; pAttr_Element attr_arr[M];

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:47:00+00:00Added an answer on June 8, 2026 at 3:47 pm

    Here I have assumed attr_Element is structure and pAttr_Element is 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 to attr_Element. That means attr_arr is a array of pointer of type attr_Element

    If you want to define array of elements of type attr_Element, directly use that type as below

    #define SIZE_OF_ELEM 20
    
    struct attr_Element attr_arr[SIZE_OF_ELEM];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a first structure like this: typedef struct { int ivalue;
I have this structure: typedef struct { int data[10]; } small_structure; and this code:
I have this complicated structure thingie: #include <stdlib.h> typedef struct { int x; int
I have a structure like this typedef struct{ int stat; }dot; And I would
I have this structure: typedef struct { char *str; ... } nameType; I create
I have this structure typedef struct fpinfo { unsigned long chunk_offset; unsigned long chunk_length;
I have a structure such as typedef struct FT_Bitmap_ { int rows; int width;
I have a structure typedef struct myStruct_st { int a; }myStruct; It can be
I have the following structure, typedef struct _MainWin { GtkWindow parent; GtkWidget* scroll; GtkWidget*
I have a structure to represent strings in memory looking like this: typedef struct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.