how does the value of variable get changed through swap function? : <p>Here I have two swap functions</p>

<pre><code>void kswap(int* a, int* b)
{
    int* temp = a;
    a = b;
    b = temp;
}


void kswap(int* a, int* b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
}
</code></pre>

<p>The value only changed inside of the first function,
<br>and the second function change the value permanently..</p>

<p>Can anyone tell me the different between two functions?
I thought as both functions take pointer type through parameter, the value would be changed through both functions..</p>
