
Naeem F. answered 07/06/21
Senior Software Engineer with 30+ years of experience
int ComputeValue(int value1, int value2)
{
return (value1 * value2) - 8;
}
You are assuming that this function returns an int, but the product of the two values can get quite big. The result may not fit into an int variable. If the values can exceed the limits of int, it might be better to change the return value to a 64 bit value.
long long ComputeValue(int value1, int value2)
{
return ((long long)value1 * value2) - 8;
}