Sorting an int[] array using insertion sort algorithm - follow-up
Nice job.  It looks like you have implemented a correct insertion sort.

The inner loop could be better written: the j &gt; 0 condition is giving an incomplete picture of how the loop terminates.

One other change you should make is to take a size parameter for the array size.  Without it, you have a function that only works on arrays of a specific size!  If you look at examples of functions in the C library, almost every function that takes an array also takes another parameter to specify its size.  Usually, the type of that parameter is an unsigned int, but called size_t to make its purpose clear.

#include &lt;stdlib.h&gt;

void insertionSort(int arr[], size_t size)
{
    for (int i = 1; i &lt; size; i++)
    {
        int value = arr[i];
        int j;
        /* Shift elements over by one slot to make way for the insertion */
        for (j = i; j &gt; 0 &amp;&amp; value &lt; arr[j - 1]; j--)
        {
            arr[j] = arr[j - 1];
        }
        arr[j] = value;
    }
}


Your implementation is better than the book you're learning from.  In fact, I would recommend using a different book, if the code examples are so poor.  Specifically, the biggest problem is the done flag.  Setting a flag to be inspected by a conditional elsewhere is a cumbersome way to implement flow control.  Your break is much more direct and assertive, and I think that my loop condition is even clearer.