here is the code https://ide.codingblocks.com/s/240378
Linked list is not getting printed
@pyash
there are few mistakes in your code
- your n become zero as you have used while(nā) loop
- condition in line 45 should be i<(n-k)-1
- add base condition in your append function i.e if(n<=k){ return; }
- your head pointer should point cur->next before initialise cur->next to NULL
can you pls help me with the changes in the code
why you stored n in n1 and then applied the while loop
@pyash
If you apply n in while loop, it become zero at the end. then there is no point of passing n in append(head,data,n,k);