c# - Can't understand result of `a + c` when both are char -


I have programmed to add a pound symbol to the input value of the user through the command line.

I can not understand the output of the console application code:

  Fixed zero main (string [] args) {char a = '\ u00A3'; // pound symbol Console.WriteLine ("Enter value"); Char c = Convert. Tochar (console. Read ()); For example // user type C console WrightLine (a + c); // this??? }  

Print Console.WriteLine (a + c) ?

When you add two codes, you actually enter two integers ( int ).

Therefore, '\ u00A3' + 'c' is (int) '\ u00A3' + (int) 'c' . ( c here as a sample, it depends on your input)

\ u00A3 ( '£' ) = 163, c = 99. Then the end result = 262 .

As a result int is ToString () printed on the ad and console.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -