Confused about pointers in C#
<p>I know this may be a low quality question but please dont -rep me because I am very confused about this as a beginner to pointers and I can't find an answer to my question anywhere...</p>

<pre><code>using System;

class MyTest
{
    unsafe static void Swap( int *a, int *b )
    {
        int tmp = *a;

        *a = *b;
        *b = tmp;
    }

    unsafe static void Main(string [] args)
    {
        int x = 5;
        int y = 12;

        Console.WriteLine( "x = {0}, y = {1}", x, y );

        Swap( &amp;x, &amp;y );

        Console.WriteLine( "x = {0}, y = {1}", x, y );
    }
}
</code></pre>

<p>I am really confused about this....Sometimes they do *ptr=&amp;address which assigns the ADDRESS which is a hexadecimal value to a pointer....so THAT is pointing the pointer to an ADDRESS which is asigning the pointer a hexadecimal value...</p>

<p>other times they do *ptr=85; which is basically asigning the pointee an integer value of 85 so *ptr holds the value 85 and doing *ptr accesses the pointer's value where as int ptr is the ADDRESS of the pointer so it doesnt make sense to me how they SWAP the addresses of the pointers when all I see them doing is swapping the VALUES by using *ptr...</p>

<p>Please clear my confusion</p>
