Tuesday 29 January 2019

Prefix operator difference in C++ and C#

Let's have this piece of code:




int a = 1;
int b = ++a + ++a;


In C++ (VS 2010) the result is: b = 6
but in C# the result is: b = 5



What's going on there? Why are the results different?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...