Hello im trying to understand why i can't cast type int To a char using a user defined function with parameters.
Im following along with learncpp. And i am a beginner, So please could i have the simplified versions.
If i create a user function, And try a return the value back it will just output the integer instead of an ASCII character.
Here is my following code.
int ascii(int y)
{
return static_cast<char>(y);
}
int main()
{
std::cout << ascii(5) << std::endl;
return 0;
}