Maha

Maha

  • NA
  • 0
  • 326.3k

Unsafe code

Oct 9 2013 7:01 AM
This program (1st one) is given in the following website.
http://www.dotnetperls.com/unsafe

When I tried to compile error message is "Unsafe code may only appear if compiling with /unsafe". Please explain the reason.

using System;

class Program
{
unsafe static void Main()
{
fixed (char* value = "sam")
{
char* ptr = value;
while (*ptr != '\0')
{
Console.WriteLine(*ptr);
++ptr;
}
}
}
}


Answers (5)