   C# arrays
  I am tested out c#. It seems as if in comparison to C and C++, you can't declare an array on the stack like thisint array[100];I have to do this insteadint[] array;array=new int[100];Why does it require dynamic memory allocation?[Edited by - V-man on May 3, 2009 3:22:56 PM]
  Basically, because arrays are reference types, not value types.   ;  In C# arrays are reference types, they inherit from the base class Array, and like all reference types they are allocated on the heap rather than the stack.   ;  Heap allocation doesn't have to be quite as bad in C# as C++ however. Modern managed languages can take advantage of a number of optimisations which can make dynamic allocation relatively cheap and garbage collection relatively quick for short lived objects.   