View Single Post
  #1 (permalink)  
Old April 18th, 2005, 06:10 AM
Obnox Obnox is offline
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Obnox
Default Take the address of a stack based array

Consider the following code:
Code:
public unsafe class PointerArray
    {
        private int size;
        private long* pArray;

        public PointerArray(int size)
        {
            this.size = size;
            long* pArray = stackalloc long [size];
            this.pArray = &(pArray);
        }
    }
I want to assign the address of the stack based array to the pointer, using
Code:
this.pArray = &(pArray);
During compile I get the following error message:
Quote:
quote:Cannot implicitly convert type long** to long*
What am I doing wrong? Is there another way of keeping a stack based array within the scope of a class

Thnx!