I have just started using pointers.So please bear with me if this looks silly But I am not able to find the reason. I have a structure
typedef struct Intermediatenode
{
int key;
char *value;
int height;
struct node *next[SKIPLIST_MAX_HEIGHT];
} node;
And I wand to create a new node by using below function
node *create_node(int key, char * val, int h)
{
node *newnode;
newnode=malloc(sizeof(node));
newnode->height=h;
newnode->key=key;
printf("till here %s \n",val);
printf("till here %d \n",newnode->height);
printf("till here %d \n",newnode->key);
strcpy(newnode->value,val);
printf("till here %s \n",newnode->value);
return newnode;
}
But I Am getting segmentation fault at this "strcpy(newnode->value,val);" Can you please help me with that.Thanks a lot