Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're using pointers and the 'address of operator' these are features commonly associated with C/C++ but are available in C# code within <code>unsafe</code> code blocks. I would recommend doing some general research on the concept because understanding the syntax alone will not be enough to effectively use them. I'll explain a few lines;</p> <pre><code> int * p; //a pointer (the address of) 4 bytes of memory for an int int a = 5; // normal allocation/initialization of int p = &amp;a; //sets p to the address of a. Since p is a pointer, it holds an address // ampersand is the 'address of operator', it returns and address. so this assignment works p = a // will not compile. int* != int p == 5 // will not compile, int* != int *p == 5 // true. *pointer dereferences the pointer returning the value // found at the address p points to which is 5 so this is true. int * q = &amp;a; // another pointer to the memory containing a p == q // true, both pointers contain the same value, some address which is usually displayed in hex like 0xFF110AB2 </code></pre> <p>A more common use of pointers would be something like;</p> <pre><code>int *p; // do something to get a length for an integer array at runtime p = new int[size]; // now I've allocated an array based on information found at run time! </code></pre> <p>The above operations are very common in C/C++ and completely necessary. In C# there's no point in doing this. It's being done for you under the covers already, and it will never make mistakes (like failing to free that memory I just allocated).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload