please tell me whats wrong
here is the code–
#include<bits/stdc++.h>
using namespace std;
class node{
public:
long long int data;
node* next;
node(long long int x){
data=x;
next=NULL;
}
};
node* insert(node* head,long long int data){
node* temp=new node(data);
node* h;
h=head;
while(h!=NULL&&h->next!=NULL)
h=h->next;
if(h==NULL){
h=temp;
head=h;
}
else
h->next=temp;
return head;
}
void func(node* &head,int p,int n){
if(p<1||p>=n-1)
return ;
node *temp=head,*ptr,*pt;
while(p–)
temp=temp->next;
ptr=temp->next;
pt=ptr;
while(pt->next!=NULL)
pt=pt->next;
pt->next=head;
head=ptr;
temp->next=NULL;
}
int main(){
long long int t;
// cin>>t;
//while(t–){
long long int n;
cin>>n;
node *head1=NULL,*head2=NULL;
long long int x;
for(long long int i=0;i<n;i++){
cin>>x;
head1=insert(head1,x);
}
int k;
cin>>k;
func(head1,n-k-1,n);
while(head1!=NULL){
cout<<head1->data<<" ";
head1=head1->next;
}
cout<<endl;
//}
return 0;
}


