Circular linked list - delete function

here is sir is using “delete” command to delete the node pointer but as I can see node is created statically then how delete command is working on that object, i have learnt that delete is used to destroy only dynamically and null pointers

i mean dynamic memory*

@sktg99 the node pointer is created statically, but the memory to which it is pointed is taken dynamically. delete does not delete a variable, rather it frees up the space that we took dynamically.

The node pointer you’re talking about is created statically, I agree, but it is pointing to some memory which we took dynamically, so when we delete on that node, it is freeing up the space in dynamic memory at which that node is pointing.

Remember, in the push function when we made new nodes using the dynamic memory, delete is freeing up that memory.