fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Copy(IntPtr ptr) {
  6. ptr = (IntPtr)(0xffffffff);
  7. }
  8.  
  9. public static void Ref(ref IntPtr ptr) {
  10. ptr = (IntPtr)(0xffffffff);
  11. }
  12.  
  13. public static void Main()
  14. {
  15. IntPtr ptr = IntPtr.Zero;
  16.  
  17. Copy(ptr);
  18. Console.WriteLine("0x{0}", ptr.ToString("x"));
  19.  
  20. Ref(ref ptr);
  21. Console.WriteLine("0x{0}", ptr.ToString("x"));
  22. }
  23. }
Success #stdin #stdout 0.02s 16092KB
stdin
Standard input is empty
stdout
0x0
0xffffffff