fork download
  1. using System;
  2. namespace Pointerprogram {
  3.  
  4. class GFG {
  5.  
  6. // Main function
  7. static void Main()
  8. {
  9. unsafe
  10. {
  11.  
  12. // declare variable
  13. int n = 10;
  14.  
  15. // store variable n address
  16. // location in pointer variable p
  17. int* p = &n;
  18. Console.WriteLine("Value :{0}", n);
  19. Console.WriteLine("Address :{0}", (int)p);
  20. Console.WriteLine("Address :{0}", (int)&p);
  21. }
  22. }
  23. }
  24. }
Success #stdin #stdout 0.03s 21940KB
stdin
Standard input is empty
stdout
Value :10
Address :497646272
Address :497646280