So i am trying to initiliaze a node of a graph. The problem is that the value of the variable node->edges_capacity changes from 2 to some random int for no apparent reason, at least to my knowledge.
Moreover, when i use the debug mode of CLion, it prints 2 as expected!
Am i doing something wrong with malloc?
typedef struct node {
   int id;
   int degree;
   int edges_capacity;
   struct node **edges;
} Node;
Node *node_create(int id) {
   Node *node = (Node *) malloc(sizeof(Node *));
   if (node == NULL)
      exit(1);
   node->id = id;
   node->degree = 0;
   node->edges_capacity = 2;
   node->edges = (Node **) malloc(node->edges_capacity * sizeof(Node *));
   node_debug(node); // prints a random int for node->edges_capacity instead of 2 
   return node;
}
void node_debug(Node *node) {
   printf("id:%d degree:%d capacity:%d\n", node->id, node->degree, node->edges_capacity);
}
 
     
     
    