char[] a = { 'o', 'r', 'a', 'n', 'g', 'e' };
for (int i = 0; i < a.Length/2; i++)
{
a[i] = (char)(((uint)a[i])|((uint)a[a.Length-(i+1)]));
a[a.Length-(i+1)] = (char)(((uint)a[i])^((uint)a[a.Length-(i+1)]));
a[i] = (char)(((uint)a[i])^((uint)a[a.Length-(i+1)]));
}
I know how to implement this using standard .NET functionality and temp vars. I am just curious what specifically I am doing wrong in the above example that causes it not to work when the following works fine:
int a = 5;
int b = 10;
a = a | b;
b = a ^ b;
a = a ^ b;
Isn't the above string version just a series of those?