Fun
A couple of easy sort algorithms for you. Look ma, no array subscripts! C is the shit, kiddies! #include <stdio.h>#include <stdlib.h>#include <string.h> #define ELEMENTS 10#define ARRAY_ELEMENT_COUNT(array) (sizeof(array)/sizeof(array[0])) //type-independent mallocvoid *MyMalloc(size_t size){ void *vp; if ((vp = malloc(size)) == NULL) { fputs(“Cannot allocate memory for malloc.n”,stderr); exit(EXIT_FAILURE); } return(vp);} //swap void pointersvoid SwapElements(void *pa,void *pb,size_t size){ [...]
