hi,
how do I create an array of pointers to a struct using malloc?

using malloc like this-

abc * a = (* abc)malloc(sizeof(abc)*10);

I get an array of struct objects. I can access member elements using the "." operator. eg a[2].xxxx

what I want is an array of pointers to struct abc, so that later i can do like-

a[2] = (* abc)malloc(sizeof(abc));

and use the "->" operator to access elements.

any help would be appreciated.


thanks

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.