2002-07-19 Martin Baulig <martin@gnome.org>
[mono.git] / mcs / tests / unsafe-2.cs
1 //
2 // This test excercises stackalloc, some pointer arithmetic,
3 // and dereferences
4 //
5 using System;
6 unsafe class X {
7         static int Main ()
8         {
9                 char *ptr = stackalloc char [10];
10                 int i;
11                 
12                 for (i = 0; i < 10; i++)
13                         ptr [i] = (char) (i + 10);
14
15                 for (i = 0; i < 10; i++){
16                         if (*ptr != (char) (i + 10))
17                                 return 200 + i;
18                         ptr++;
19                 }
20                 Console.WriteLine ("Ok");
21                 return 0;
22         }
23 }       
24
25