Because a char
can be implicitly cast to an int
. The type of the variable i
would still be int
– you can test this using i.GetType()
– and its value would be the codepoint of the character 'K'
(namely, 75
).
In other words, your code is equivalent to writing:
int i = 'K';
“As far as my concept is concerned, I cannot re-assign a value in var.” – That is not correct. You cannot change the type of an implicitly-typed variable (just like you cannot change the declared type of any other variable), but you are allowed to re-assign it another value of the same type (or one that may be cast as so).