In C#, pointers are allowed only in special cases, only under
unsafe
content. Please see:
unsafe (C# Reference)[
^],
Unsafe Code Tutorial (C#)[
^].
Pointers to managed memory usually related to
pinning:
fixed Statement (C# Reference)[
^].
All the above is used very rarely in the cases when you need much deeper understanding of the technology.
From your question, it's apparent that you don't really need pointers, you are just unaware how .NET and C# work on the high level. With .NET, you are working with
managed memory. You don't deallocate memory and not allocate it explicitly, instead, memory is allocated when you use constructors of the
reference types (you will need to learn reference types vs. value types) and initialization of arrays:
double[] myArray = new double[10];
See also:
Garbage collection (computer science) — Wikipedia, the free encyclopedia[
^].
You really need to grab the manual on the platform, language and general programming and read it all, from the beginning to the end; it would be the best to do the simplest exercises. Perhaps, you may also need to "unlearn what you have learned".
—SA