1

I came across this line,

C# allows pointers but only in unmanaged code.

From Definition of Pointer, I read about this already in C and C++ friend functions. I didn't understand or get further explanations from that site if C# allows pointers...

What is some code for this or an understandable definition?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Arun
  • 851
  • 1
  • 9
  • 19
  • [Pointer types (C# Programming Guide)](http://msdn.microsoft.com/en-us/library/y31yhkeb.aspx) – Habib Apr 25 '14 at 14:22
  • 5
    C# allows pointers in *unsafe* code, not unmanaged code. You can't write unmanaged code in C#. – Thomas Levesque Apr 25 '14 at 14:23
  • You can refer to MSDN for explanations about [Unsafe Code and Pointers](http://msdn.microsoft.com/en-us/library/t2yzs44b.aspx "Unsafe Code and Pointers") using C# – Anthony Froissant Apr 25 '14 at 14:23
  • @ThomasLevesque ar this site i read.. http://cplus.about.com/od/introductiontoprogramming/g/pointerdefn.htm – Arun Apr 26 '14 at 04:31
  • @user3563106, well, this site is wrong ;) – Thomas Levesque Apr 26 '14 at 10:20
  • @ThomasLevesque Offically its unsafe code , meaningfully used both words huh .. ty for ur reply – Arun Apr 26 '14 at 13:35
  • @ThomasLevesque Well, since you're hung up on the wording, I thought I'd chime in. C# compiles to CIL, which uses the keywords `managed` and `unmanaged` that correspond to "safe and "unsafe". So therefore when you write unsafe code in C#, you're really writing unmanaged code. [See Wikipedia](http://en.wikipedia.org/wiki/Common_Intermediate_Language) for some examples of CIL with managed and unmanaged code. – mason May 09 '14 at 17:03

0 Answers0