title: Delete_At Function for Linked List crashing the program
body: <p>I created a Linked List class ,everything works just fine but when i run Delete_At Function it get crashed ! , no syntax errors given , it's logical,i really don't know what i am missing</p>
  
  <p>here is the code :</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  
  
  struct node{
  
  int info;
  
  node *link;
  
  };
  
  
  class Linked_List{
  
  
  private :
  
  int count;
  node *first;
  node *last;
  node *current;
  
  public:
  
  
  Linked_List() {
  
  count=0;
  first=NULL;
  last=NULL;
  }
  
  
  
  void Initialize_List(){
  
  cout&lt;&lt;"Enter Number OF Nodes"&lt;&lt;endl;
  cin&gt;&gt;count;
  
  first=last=current=new node;
  
  for(int i =0;i&lt;count;i++){
  cout&lt;&lt;"Enter New Node Info :"&lt;&lt;endl;
  cin&gt;&gt;current-&gt;info;
  last-&gt;link=current;
  last=current;
  current=new node;}
  last-&gt;link=NULL;
  }
  
  
  void Insert_At (int loc,int element){
  
  
  for (current=first;current!=NULL;current=current-&gt;link){
  if (current-&gt;info==loc){
  
  node *newnode= new node;
  newnode-&gt;info=element;
  
  newnode-&gt;link=current-&gt;link;
  current-&gt;link=newnode;
  count++;}
  }
  if(current==last){
  node *newnode= new node;
  newnode-&gt;info=element;
  
  last-&gt;link=newnode;
  last=newnode;
  newnode-&gt;link=NULL;}
  }
  
  
  void Delete_At(int loc){
  bool found;
  
  node *p=new node;
  if(first ==NULL)
  cout&lt;&lt;"can't delete from empty list"&lt;&lt;endl;
  
  
  else {
  found = false ;
  current=first;
  p=first-&gt;link;
  
  while (p!=NULL){
  
  if(p-&gt;info!=loc){
  
  current=p;
  p=p-&gt;link;}
  
  else found = true;}
  
  if (found) {
  current-&gt;link=p-&gt;link;
  count--;
  delete p;} }}
  };
  
  void main (){
  
  
  Linked_List obj;
  
  obj.Initialize_List();
  
  obj.print();
  
  obj.Insert_At(3,10); cout&lt;&lt;"item inserrted"&lt;&lt;endl;
  
  obj.print();
  
  obj.Delete_At(3);  cout&lt;&lt;"item deleted"&lt;&lt;endl;   //lets say i have  number 3 in my 
  list.
  
  obj.print();
  
  }
  </code></pre>