Linked list is not getting printed

here is the code https://ide.codingblocks.com/s/240378

@pyash
there are few mistakes in your code

  1. your n become zero as you have used while(n–) loop
  2. condition in line 45 should be i<(n-k)-1
  3. add base condition in your append function i.e if(n<=k){ return; }
  4. your head pointer should point cur->next before initialise cur->next to NULL

can you pls help me with the changes in the code

@pyash


check whether these changes work or not

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);