This is a short program for a linked list. I am not sure if I got the process correctly. Any help is much appreciated.
Code:
 
#pragma once
class LinkedList
{
public:
 LinkedList(void);
 ~LinkedList(void);
 void add(char c){
  Node temp=new Node;
  Node temp2=new Node;
  temp->token=c;
  if(strPtr==NULL){
   strPtr=temp;
   strPtr->link=NULL;
  }
  else{
   for(temp=strPtr; temp->link!=NULL; temp=temp->link){}
   temp2->token=c;
   temp->link=temp2;
   temp2->link=NULL;
  }
 }
 
 void remove(Node node){
  Node temp;
  temp=strPtr;
  if(temp==node){
   strPtr=NULL;
   delete temp;
  }
  else if (strPtr!=NULL){
   for(temp=strPtr; temp->link!=node; temp=temp->link){}
   temp=temp->link->link;
   delete temp->link;
  }
 }
private:
 struct Node{
  char * token;
  Node * link;  
 } 
 Node * stPtr=NULL;
};

Last edited by shabbir; 23Jan2009 at 20:16.. Reason: Code blocks