[ create a new paste ] login | about

Link: http://codepad.org/r2SIYSiy    [ raw code | output | fork ]

C, pasted on Jan 12:
1
2
3
4
5
6
7
8
s(int*a,int l){if(l>2){l=(l+1)*2/3;s(a,l);s(a+l/2,l);s(a,l);}if(*a>a[1])*a^=a[1]^=*a^=a[1];}

int main(){
  int a[10] = {4,5,2,3,7,1}, i;
  s(a,6);
  for(i=0;i<6;++i) printf("%d",a[i]);
  return 0;
}


Output:
1
123457


Create a new paste based on this one


Comments: