Syntax for creating a node 1

Syntax for creating a node

struct Node *ptr = (struct Node*) malloc (sizeof (struct Node))

Here is what the above code is Doing:
1. We are creating a pointer variable ptr of type struct Node.
2. We are allocating memory to the pointer variable ptr using malloc() function.
3. We are casting the return value of malloc() function to (struct Node*).

Similar Posts