Link to home
Start Free TrialLog in
Avatar of kuntilanak
kuntilanakFlag for United States of America

asked on

dynamic 2d array of pointers

Say I have a struct called PCB, how can I declare a 2d array of pointers to PCB inside the heap? How do I access it?
ASKER CERTIFIED SOLUTION
Avatar of Subrat (C++ windows/Linux)
Subrat (C++ windows/Linux)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kuntilanak

ASKER

is it possible to initialize the table to null at first??
yes.
a[x] = (int*)calloc(sizeof(int), 3);
so if it's an array of pointer to a pcb, where pcb is a struct will it be something like:

int ***a = (int**)malloc(sizeof(pcb *) * 10);
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes that was a typo