typedef struct Node
{
void ** pointers;
Value ** keys;
struct Node * parent;
bool is_leaf;
int num_keys;
struct Node * next;
} Node;
typedef struct ScanManager {
int keyIndex;
int totalKeys;
Node * node;
} ScanManager;
I am getting an error "Segmentation fault (core dumped)" when I try to allocate memory for my structure ScanManager. I am writing -
ScanManager * scanmeta = (ScanManager *) malloc(sizeof(ScanManager));
I have tried using calloc
instead of malloc
but that didn't work. How do I allocate memory for that structure since I want to use it further in my code?
typedef struct Value {
DataType dt;
union v {
int intV;
char *stringV;
float floatV;
bool boolV;
} v;
} Value;
Also, I have one more structure -
typedef struct BT_ScanHandle {
BTreeHandle *tree;
void *mgmtData;
} BT_ScanHandle;
I am passing this structure's reference in a function as mentioned below and try to access my ScanManager structure here -
openTreeScan(BT_ScanHandle **handle)
{
struct ScanManager *scanmeta = malloc (sizeof (struct ScanManager));
(** handle).mgmtData = scanmeta;
/* Remaining code */
}