Manish Tewatia

Manish Tewatia

  • Admin
  • 80.3k
  • 3.2m

How to use stackalloc?

Apr 12 2011 1:52 AM
Is this code is correct, I want to allocate memory from the stack..

using System;
using System.Globalization;

public class ABC{

 static void Main(string[] args)
 {
 
 unsafe 
 {
 char* i = stackalloc[256];
 for (int j = 0; j < 256; j++) 
 i[j] = (char)j;
 
 }
}

Answers (1)