I'm getting the error message segmentation fault for the following function. I was wondering if anyone could help me fix this problem
Polynomial Polynomial :: multiply(const Polynomial& p) const{
//The functions returns the mathematical product of the host polynomial and p
// new object created
Polynomial multiply;
// node that points to the beginning of the list
Node *temporary = m_head;
Node *copy = p.m_head;
long num_coeff;
unsigned int num_deg;
while(temporary -> m_next != NULL){
copy = p.m_head;
while(copy -> m_next != NULL){
Polynomial variable;
num_coeff = temporary -> m_coefficient * copy -> m_coefficient;
num_deg = temporary -> m_degree + copy -> m_degree;
variable.insertMonomial(num_coeff, num_deg);
multiply.add(variable);
copy = copy -> m_next;
}
temporary = temporary -> m_next;
}
return multiply;
}