The following code shows a C Program for Implementing Selection Sort.

// Selection Sort Implementation in C

#include <stdio.h>
void swap(int arr[], int m, int n);
void SelectionSort(int myarray[], int length)
{
    int i;
    int min_index;
    for (i = 0; i<length - 1; i++)
    {
        min_index = i;
        for (int j = i + 1; j<length; j++)
        {
            if (myarray[j] < myarray[min_index])
            {
                min_index = j;
            }
        }
        swap(myarray, i, min_index);
    }
}
void swap(int myarray[], int m, int n)
{
    int t = myarray[m];
    myarray[m] = myarray[n];
    myarray[n] = t;
}
int main()
{
    int i, count;
    int myarray[] = { 4, 1, 9, -13, 90, 56, 81, 34, -2, -15, 60, 88 };
    count=sizeof(myarray)/sizeof(int);
    printf("Array before sorting...");
    for(i=0;i<count;i++)
        printf("%d ", myarray[i]);
    SelectionSort(myarray, count);
    printf("\nArray after sorting...");
    for(i=0;i<count;i++)
        printf("%d ", myarray[i]);
    printf("\n\n");

    return 0;
}

Output

Selection Sort Implementation in C Language
Selection Sort Implementation in C Language

Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number