Skip to content

Instantly share code, notes, and snippets.

@arknave
Last active December 10, 2020 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arknave/21b71701de5cc67f38244c608d3b79e0 to your computer and use it in GitHub Desktop.
Save arknave/21b71701de5cc67f38244c608d3b79e0 to your computer and use it in GitHub Desktop.
// Say you have an integer array of length n. Then this monstrosity sorts it, slowly.
void cursed_sort(int* a, int n) {
int*q,i;
for(i=0;i<n;++i)
for(q=a;q+1<a+n;++q)
if(*q>*(q+1))
*q^=*(q+1)^=*q^=*(q+1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment