Here is a function to sort an array in ascending order using selection sort algorithm:
#include <stdio.h>
void selectionSort(int array[], int size){
int i, j, min, temp;
for(i=0; i<size-1; i++){
min = i;
for(j=i+1; j<size; j++){
if(array[j] < array[min])
min = j;
}
temp = array[i];
array[i] = array[min];
array[min] = temp;
}
}
int main(){
int arr[] = {5, 3, 6, 2