I have a serious trouble to which I found no explanation, if someone can help me this would save me really:
In my code I have lots of structures. I try to make tables of structures and then get access to elements of the structures to use them all along my code: here is an example to clarify things
Expand|Select|Wrap|Line Numbers
- typedef struct {
- Fabric **closfabric;
- }Network;
I have done the following
Expand|Select|Wrap|Line Numbers
- aSwitch->net.closfabric = (Fabric **)malloc(3* sizeof(Fabric *));
- aSwitch->net.closfabric[0] = (Fabric *)malloc(m * sizeof(Fabric ));
- aSwitch->net.closfabric[1] = (Fabric *)malloc(k * sizeof(Fabric ));
- aSwitch->net.closfabric[2] = (Fabric *)malloc(m * sizeof(Fabric ));
surprisingly, in other codes the same analogy of using tables made of double pointers works perfectly with no problems and I have no problem of core dumped and NULL pointers.
I am lost and I cannot understand why am I getting this problem. It is the case whenever I try to use large dimension tables (tab *** struct for example)
Regards,
Monson