Advertisement
T-D-K

Untitled

Jan 4th, 2016
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.29 KB | None | 0 0
  1. var s = "Strings are immutable";
  2. int length = s.Length;
  3. unsafe
  4.  {
  5.   fixed (char* c = s)
  6.    {
  7.     for (int i = 0; i < length / 2; i++)
  8.      {
  9.       var temp = c[i];
  10.       c[i] = c[length - i - 1];
  11.       c[length - i - 1] = temp;
  12.      }
  13.    }
  14.  }
  15. Console.WriteLine("Strings are immutable");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement