void insertLatLonBeg(double latIn, double lonIn);
    
void insertLatLonEnd(double latIn, double lonIn);

\\

void insertLatLonBeg(double latIn, double lonIn)
{
  struct node *newNodePtr;
  newNodePtr=(struct node *)malloc(sizeof(struct node));
  newNodePtr->Lat=latIn;
  newNodePtr->Lon=lonIn;
  if(headNodePtr==NULL)
  {
    newNodePtr->prevPtr=newNodePtr->nextPtr=NULL;
    headNodePtr=newNodePtr;
     tailNodePtr=newNodePtr;
  }
  else
  {
    newNodePtr->nextPtr=headNodePtr;
    newNodePtr->prevPtr=NULL;
    headNodePtr->prevPtr=newNodePtr;
    headNodePtr=newNodePtr;
    }
    return;
}


void insertLatLonEnd(double latIn, double lonIn)
  struct node *newNodePtr,*loopPtr;             // new node ptr and loop ptr
   newNodePtr=(struct node *)malloc(sizeof(struct node));
   newNodePtr->Lat=latIn;
   newNodePtr->Lon=lonIn;
   if(headNodePtr==NULL)    //if no list yet
   {
     newNodePtr->prevPtr=newNodePtr->nextPtr=NULL;
     headNodePtr=newNodePtr;
     tailNodePtr=newNodePtr;
   }
   else
   {
   loopPtr=headNodePtr;
   while(loopPtr->nextPtr!=NULL)
     {
       loopPtr=loopPtr->nextPtr;
     }
   newNodePtr->prevPtr=loopPtr;
   loopPtr->nextPtr=newNodePtr;
   newNodePtr->nextPtr=NULL;

   tailNodePtr=newNodePtr;
   }
     return;
}

