I need some help, ive been trying for a few days to make a linked list, but it keeps on crashing, or not working at all. its kind of wierd though, I can do opengl, but cant make a linked list :P
Code:
#include <stdio.h>
#include <iostream>
using namespace std;
class PATIENT
{
public:
char Name[10];
char Gender;
int Age;
char Insurance;
char Insurance_Name[24];
PATIENT* pNext;
};
PATIENT* head;
void AddPatient(PATIENT* pND)
{
pND->pNext = NULL;
PATIENT* head;
if (head=0)
{
head = pND;
return ;
}
PATIENT* current = head;
while (current->pNext)
{
current = current->pNext;
}
current->pNext = pND;
}
void PrintList(PATIENT* head)
{
while(head != NULL)
{
cout << head;
}
}
int main()
{
PATIENT* pND;
cout <<" enter patient name : ";
cin >> pND->Name;
cout<<"\n\n";
AddPatient(pND);
whats the matter with it, and can someone give a link to a site that has a good tutorial on linked lists, as all the books I have barely skim the topic.