VitzzViperzz
Well-known member
So I was following this book and it was okay, then it shows an example of a few conversions and I get confused.
So we are converting a few values between each other and then printing the value to the console, but it says this is the output:
I don't quite understand it. Where did we get the 97 from? Don't we lose the value of sourceVar if we are converting the value? How has he still managed to print its initial value?
If I could get an explanation, that would be great.
C#:
ushort destinationVar;char sourceVar = 'a';
destinationVar = sourceVar;
WriteLine($"sourceVar val: {sourceVar}");
WriteLine($"destinationVar val: {destinationVar}");
So we are converting a few values between each other and then printing the value to the console, but it says this is the output:
C#:
sourceVar val: a
destinationVar val: 97
I don't quite understand it. Where did we get the 97 from? Don't we lose the value of sourceVar if we are converting the value? How has he still managed to print its initial value?
If I could get an explanation, that would be great.