IMPORTANT
If you decide to try the following codes, please do so at your own risk.
If the program is out of control and you are in trouble, press <Ctrl-C> to stop it.
Bubble sort
signed(sw(signed(*di),signed(*si))) {
auto signed r;
if(!di) return(0x00);
if(!si) return(0x00);
r = (*di);
*di = (*si);
*si = (r);
return(0x01);
}
signed(nsort(signed(arg),signed(*argp))) {
auto signed r;
if(!arg) return(0x00);
if(!argp) return(0x00);
r = (*(0x01+(argp)));
if(r<(*argp)) {
if(!(sw(&r,argp))) return(0x00);
*(0x01+(argp)) = (r);
}
argp++;
return(0x01+(nsort(--arg,argp)));
}
signed(bsort(signed(arg),signed(*argp))) {
auto signed r;
if(arg<(0x01)) return(0x00);
if(!argp) return(0x00);
r = nsort(--arg,argp);
if(arg^(r)) return(0x00);
return(0x01+(bsort(arg,argp)));
}
Example
# include <stdio.h>
signed(main(void)) {
auto signed r;
auto signed a[10] = {
1,3,5,7,9,0,2,4,6,8,
};
r = (10);
while(r) printf("%d ",*(--r+(a)));
printf("\n");
r = bsort(10,a);
if(10^(r)) {
printf("%s \n","<< Error at fn. bsort()");
return(0x00);
}
while(r) printf("%d ",*(--r+(a)));
printf("\n");
return(0x00);
}