Difference between Managed and Unmanaged code in .NET
The managed code is the code which is managed by the CLR(Common Language Runtime) in DotNet Framework. Whereas the Unmanaged code is the code which is directly executed by the operating system. Here the below are some important differences between the Managed code and Unmanaged code:
Example :-
static unsafe void Main(string[] args) {
int var = 20;
int* p = &var;
Console.WriteLine("Data is: {0} ", var);
Console.WriteLine("Address is: {0}", (int)p);
Console.ReadKey();
}