Quote:
Originally Posted by Kevin Watson
Your code should probably look like this:
Code:
unsigned char limit(int value)
{
if(value >255);
value =255;
else if(value <0);
value =0;
return (unsigned char)value;
}
|
Kevin, I think you forgot to remove the semicolons after the IFs in your reply. I think you meant it to be
Code:
unsigned char limit(int value)
{
if(value > 255)
value = 255;
else if(value < 0)
value = 0;
return (unsigned char)value;
}