To start, your function is done wrong. Decipher the commented code below for more info.
Secondly, you should always return something by default which fixes the problem referenced above anyways.
float Clamp(float value, float min, float max)
{
if(value < min)
{
return min;
}
if(value > max)
{
return max;
}
// WRONG: (original)
//if(min <= value || value >= max)
//{
// return value;
//}
// CORRECT: (edited)
//if(min <= value || max >= value)
//{
// return value;
//}
return value; // default return
}
Unless you show more code, the only other potential problem I see is that your player variables have different names.
playerPositionX = Clamp(playerPositionX, 0, windowWidth);
playerBoundingBoxY = Clamp(playerPositionY, 0, windowHeight); // Intended to be playerPositionY?