the specific problem is that there are no errors in the prob but it is giving segmentation fault.plz check it
#include<iostream.h>
#include<conio.h>
void main()
{
struct mylist{
mylist * nxt;
int val;
};
int a,b,c,d=1,i,j;mylist * t;
clrscr();
cout<<"Enter the no&the total no of numbers";
cin>>a>>b;
mylist * head=new mylist;
head=NULL;
mylist * newnode=new mylist;
newnode->val=a;
newnode->nxt=head;
head=newnode;
for(i=1;i<b;i++)
{
d=1;
cout<<"Enter the next number";
cin>>c;
mylist * newnode=new mylist;
newnode->val=c;
for(j=1;j<=i;j++)
{
if(newnode->val<head->val)
{
if(d==1)
{
newnode->nxt=head;
head=newnode;
}
if(d==b)
{
newnode->nxt=NULL;
t->nxt=newnode;
}
if(1<d<b)
{
newnode->nxt=head;
t->nxt=newnode;
}
}
else
{
t=head;
head=head->nxt;
d=d+1;
}
}
}
cout<<"the new order is:\n ";
while(head)
{
cout<<head->val<<" ";
head=head->nxt;
}
getch();
}