0

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

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by bhas_purk
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.