Demonstrate stackalloc : StackAlloc : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » StackAlloc »

 

Demonstrate stackalloc









    

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/


// Demonstrate stackalloc. 
 
using System; 
 
public class UseStackAlloc { 
  unsafe public static void Main() { 
    int* ptrs = stackalloc int[3]; 
 
    ptrs[0] = 1; 
    ptrs[1] = 2; 
    ptrs[2] = 3; 
 
    for(int i=0; i < 3; i++) 
      Console.WriteLine(ptrs[i]); 
  } 
}


           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» StackAlloc