Having some serious trouble

long getanswer(int totallength)
{
  if(Serial.available())
  {
    int number;
    char ch=Serial.read();
    if(isDigit(ch))
    {     
      number=(number*10)+(ch-48);
    }
    else if(ch==10)
    {
      totallength=number;
      return totallength;
    }
  }
}

You may have noticed that the return type of "getanswer" is "long", but if you actually return a value, it is only an "int".