Question about the meaning of (char)key)

Please comment.

What is (char) in the following function?

void KbdRptParser::OnKeyPressed(uint8_t key)
{
Serial.print("ASCII: ");
Serial.println((char)key);
};

You are casting key into a character then printing it.

char is a data type, it is an 8 bit value normally used for holding character data like ASCII codes.

In the print statement it tells the compiler to treat the number it contains as a ASCII value.