API
Marshal.AllocHGlobal
Allocates unmanaged memory; pair with FreeHGlobal.
Formal Syntax & Structure
csharp syntaxcsharp
IntPtr p = Marshal.AllocHGlobal(4);Working Example
Example Snippetcsharp
// Documentary fragment; see linked lesson for context.IntPtr p = Marshal.AllocHGlobal(4);