guys i was working on the link list program and its is encountring a problem its says some thing like
un handled exaption handling acess writing location error
i have no idea howto over come it so i thought may be u guys might help me with it
here is the code
// abdul muqeet khan.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include <cstdlib>
using namespace std;
struct node
{
int data;
node* next ;
node* previous;
};
node* head=NULL;
node*
previous=NULL;
char ch;
/////////////////////////////////////////////////////////////////////////////////////////
// functio declarations
node* getnode();
void addstart(int);
void display();
int dataentry();
////////////////////////////////////////////////////////////////////////////////////////
int _tmain(int argc, _TCHAR* argv[])
{ while(ch!='y'||'Y')
{int c;
c=dataentry();
addstart(c);
display();}
cout<<"do u wanna an other go ";
cin>>ch;
system("pause");
return 0;
}
int dataentry(void)
{ int c;
cout<<"enter the num";
cin>>c;
return c;
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
void addstart(int c)
{
struct node*p;
struct node*q;
p=getnode();
q=getnode();
q=NULL;
if(head==NULL)
{p=head;
p->next=q;
q->next=NULL;
}
if(head!=NULL)
{ p=head;
while(p->next!=NULL)
{
p=p->next;}
}
p->next=q;
q->data=c;
q->next=NULL;
system("pause");
system("cls");
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
node* getnode()
{
node*p;
p=(node*)malloc(sizeof(node));
return p;
}
void display()
{
node*p;
p=getnode();
p=head;
while(p->next!=NULL)
cout<<p->data;
p=p->next;
}