This is not really a problem but a small doubt.
I was creating a function to insert a key value in a linked list.
void Insert_val(ListNode **l , int x)//to insert value of x;
{
ListNode *p ;//create a pointer to datatype ListNode
p = malloc(sizeof(ListNode));//give pointer chunk from memory to store data
p->val = x;//value of p is x
p->next = *l;// next ptr of p points to 1st node
*l = p;//head ptr of list points to p making it first node
}
After allocating memory to a pointer how it divides memory into two parts that contain value x and next pointer?
How does p pointer do that pointer p just points to a datatype of type ListNode when given a random chunk of memory, how it divides it so that it make the required datatype?