See also
Interapp Control
Interapp Control 2
Interapp Control 3
References
Category:Computer storage companies
Category:Software companies of IsraelQ:
Segmentation Fault using realloc() function
I was wondering if anybody can help me. I am trying to get dynamic array of object pointers (with their pointers to object in other array) to store custom data.
In my mind, there will be two arrays. First array will be of pointer to objects. Second array will be of this pointers.
I am able to store data but only first object in new array. When I try to add new pointer, I get segmentation fault. What I am doing wrong here?
Thank you for your help in advance.
int index = 0;
int count = 0;
#define MAXOBJPERROW 30
#define MAXOBJPERCOL 10
typedef struct {
int first;
int second;
} object;
typedef struct{
int* first;
int* second;
int* third;
}table;
typedef struct{
object* obj;
table* table;
}myTable;
myTable myObj;
myTable* myObjTable;
myTable* addMyTable(int* a, int* b, int* c){
int index = 0;
int count = 0;
myTable* myTable = malloc(sizeof(myTable));
myTable->obj = malloc(sizeof(object));
myTable->obj->first = a;
myTable->obj->second = b;
myTable->obj->third = c;
myTable->table = malloc(sizeof(table));
myTable->table->first = &myTable->obj->first;
myTable->table->second = &myTable->obj->second;
myTable->table->third = &myTable->obj->third;
myTable->table->first[count] = *a;
myTable->table->second[count] = * be359ba680
Related links:
Comments