0
[linked list] What does this line mean ptr = (struct node)malloc(size of(struct node))
i also wanna know what does malloc do and how do we get to know where is the first node ?
1 Answer
- 1
you have not write right syntax
ptr = (struct node*)malloc(sizeof(struct node));
It is use to create a memory block in Ram. Mainly use in Data structure. Always use pointer variable to create a memory block because a pointer can contain adress of memory block.
It create struct node size memory block. for more comment