[Solved] How can I use head in place of struct node?


Yes, you can and you will run into problems. Since C does not do any boundary checking for you, you are only getting an illusion of it working correctly. You are just getting lucky that no one else is using the piece of memory you are accessing in your *next pointer. So, it may not may not work if you try this code on a different machine or on the same machine a few mins/hrs later. You are essentially corrupting the memory here by writing over a piece of memory which you have not malloc’ed.

solved How can I use head in place of struct node?