Is my implementation of insertion sort is correct?
By inspection, your implementation is incorrect: arr[0] can never be written to.  The only code that writes to arr is inside the while loop, and the body of the while loop will only execute when j &gt; 0.

In addition, the style could be improved.  Any code of the form

int j = …;
while (some condition involving j)
{
    …
    j--;
}


would be more easily recognizable if written as a for-loop.

The body of the inner loop looks like it performs swaps with neighbouring elements.  You should be able to shift multiple elements over by one slot by doing fewer writes than that.