Here is what I've tried
int two = 2;
int asciiX = (int) 'x';
int asciiTwo = (int) two;
Console.WriteLine("The ascii value of 2 is " + asciiTwo);
Console.WriteLine("The ascii value of x is " + asciiX););
I expected the output to be 50 as the ascii value of 2 is 50 (which is the ASCII code of '2')
But I got this result :
The ascii value of 2 is 2
The ascii value of x is 120 (it's working for x)
I know that if I put int asciiTwo = '2'; it will works, but it's not directly processing from the variable how can I do, to get the ascii code of a number which is in a int variable ?