// Version 2

// using semanticlly clear statement (avoiding C pointer arithmetics)

#include <stdio.h>

void main()
{
    int d[] = {12, 3, 37, 8, 24, 15, 5, 33};
    int n = 32 / 4;
    int i, j, k;
    
    i = 0;
    while (i<n)
    {
        k = i;
        j = i + 1;
        while (j<n)
        {
            if (d[j]<d[k]) k = j;
            j = j + 1;
        }
        j = d[k];
        d[k] = d[i];
        d[i] = j;
        i = i + 1;
    }
    printf("Sorted data:\n");
    i = 0;
    while (i<n)
    {
        printf(" %d", d[i]);
        i = i + 1;
    }
    printf("\n");
}