next up previous contents
Next: Find the Address of Up: Finding Addresses: Previous: Find the Address of

Find the Address of the Element Before:

    // ************************************ //
    // find address before a given element  //
    // ************************************ // 
FLOAT_POLY_CELL* FLOAT_POLY::get_before_element_address(unsigned int p)
{
  FLOAT_POLY_CELL *temp;
  if(!(head==NULL)){
    temp = head;
    if(p==temp->power){
      //cout << "power is at head of list, so before address is NULL"
      //     << endl;
      return(NULL);
      }
    while(!(temp->next==NULL)){
      if(p==temp->next->power){
        //temp is address of cell before cell containing search_key
        return(temp); 
        }     
      temp = temp->next;
      }
    }
  return(NULL);
}



Jim Peterson
1999-04-22