Разница в назначении C# и C++, хотя их порядок и направление операций одинаковы [дубликат] ⇐ C++
-
Anonymous
Разница в назначении C# и C++, хотя их порядок и направление операций одинаковы [дубликат]
After finding the reason for why the following code works the way it does in C#, I tried the near identical code in C++ and got a different result, even though their stated orders of operations and their direction of evaluation for the matching elements are the same.
In C#:
int i = 0; int [] arr = { 99, 99 }; arr[i++] = i; Console.WriteLine("[{0:G}, {1:G}]\n", arr[0], arr[1]); // output: [1, 99] In C++:
int i = 0; arr[] = {99, 99}; arr[i++] = i; std::cout
Источник: https://stackoverflow.com/questions/781 ... irection-o
After finding the reason for why the following code works the way it does in C#, I tried the near identical code in C++ and got a different result, even though their stated orders of operations and their direction of evaluation for the matching elements are the same.
In C#:
int i = 0; int [] arr = { 99, 99 }; arr[i++] = i; Console.WriteLine("[{0:G}, {1:G}]\n", arr[0], arr[1]); // output: [1, 99] In C++:
int i = 0; arr[] = {99, 99}; arr[i++] = i; std::cout
Источник: https://stackoverflow.com/questions/781 ... irection-o
Мобильная версия