I have a Color class that contains three components of float (r, g, b).
I need to program the following function:
Color getColor (unsigned char values โโ[], int i)
Usually I should program it like this:
Color getColor(unsigned char values[], int i){ return Color((float) values[i]/255.0, (float) values[i+1]/255.0, (float) values[i+2]/255.0); }
But by mistake I did
return values[i];
When I compiled, I did not receive any compilation error, and I did not receive a runtime error either.
Why is this possible?
Hunsu source share