fork download
  1. #include <stdio.h>
  2.  
  3. j;f(l,i)int*l;{j=i-1;while(i-->0)while(j-->0)if(l[j]<l[i]){l[j]=l[i];return;}}
  4.  
  5. int main(void)
  6. {
  7. const int n = 5;
  8. int l[] = { 3, 1, 4, -1, 2 };
  9.  
  10. for(int i=0;i<n;i++) printf("%d ",l[i]);
  11. printf(" > ");
  12. f(l,n);
  13. for(int i=0;i<n;i++) printf("%d ",l[i]);
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0s 9432KB
stdin
Standard input is empty
stdout
3 1 4 -1 2  > 3 1 4 2 2