This is supposed to return the sum of inches and feet within strucst. Why won't this work? *Attempting to return a reference to local variable "tempDist"* error
Code:englishDist &operator +(englishDist distances1, englishDist distances2){ englishDist tempDist; double feet = distances1.feet + distances2.feet, inches = distances1.inches + distances2.inches; double temp = fmod(inches, 12.0); tempDist.feet = int(feet + ((inches - temp) / 12.0)); tempDist.inches = temp; return tempDist; } //end englishDist &operator +



LinkBack URL
About LinkBacks


