Unexpected output from string concatenation.

  • Thread starter Thread starter nigelwright7557
  • Start date Start date
N

nigelwright7557

Guest
I added the following code to my program.

string str;

str="00."+'0';

The '0' part was converted to a decimal number then added to str giving 00.48

I would have expected to get str="00.0".

In C# I do get 00.0.

Yes I know I could use "00."+"0" but the compiler should have added strings or thrown up an error.



n.Wright

Continue reading...
 
Back
Top