#include <stdio.h>
void ft_sort_int_tab(int *tab, int size){
int i;
int menor;
int pos;
size--;
i = 0;
while(i < size){
if(i == 0){
menor = tab[i];
pos = i;
}else if(tab[i] < menor){
tab[pos] = tab[i];
tab[i] = menor;
}
i++;
}
}
int main() {
int tab[4] = {4, 2, 1, 3};
int i = 0;
int size = 4;
ft_sort_int_tab(tab, size);
while(i < size){
printf("%d ", tab[i]);
i++;
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgoKdm9pZCBmdF9zb3J0X2ludF90YWIoaW50ICp0YWIsIGludCBzaXplKXsKCWludCBpOwogICAgaW50IG1lbm9yOwogICAgaW50IHBvczsKICAgIHNpemUtLTsKICAgCiAgICBpID0gMDsKICAgIHdoaWxlKGkgPCBzaXplKXsKICAgIAlpZihpID09IDApewogICAgICAgIAltZW5vciA9IHRhYltpXTsKICAgICAgICAgICAgcG9zID0gaTsKICAgICAgICB9ZWxzZSBpZih0YWJbaV0gPCBtZW5vcil7CiAgICAgICAgCXRhYltwb3NdID0gdGFiW2ldOwogICAgICAgICAgICB0YWJbaV0gPSBtZW5vcjsKICAgICAgICAgICAgCiAgICAgICAgfQogICAgICAgIGkrKzsKICAgIH0KfQoKaW50IG1haW4oKSB7CiAgaW50IHRhYls0XSA9IHs0LCAyLCAxLCAzfTsKICBpbnQgaSA9IDA7CiAgaW50IHNpemUgPSA0OwogIGZ0X3NvcnRfaW50X3RhYih0YWIsIHNpemUpOwogIHdoaWxlKGkgPCBzaXplKXsKICAJcHJpbnRmKCIlZCAiLCB0YWJbaV0pOwogICAgaSsrOwogIH0KICByZXR1cm4gMDsKfQ==