Category : Files from Magazines
Archive   : CUJ9304.ZIP
Filename : 1104114B
#include
#include
#include
#define NELEMS 7
static int comp(const void *, const void *);
static int some_ints[NELEMS] = {40,12,37,12,40,15,15};
main()
{
int last;
size_t i;
size_t idx[NELEMS] = {0,1,2,3,4,5,6};
qsort(idx,NELEMS,sizeof idx[0],comp);
/* Output only unique items */
printf("%d\n",(last = some_ints[idx[0]]));
for (i = 1; i < NELEMS; ++i)
if (some_ints[idx[i]] != last)
printf("%d\n",(last = some_ints[idx[i]]));
return 0;
}
static int comp(const void *p1, const void *p2)
{
size_t i = * (size_t *) p1;
size_t j = * (size_t *) p2;
return some_ints[i] - some_ints[j];
}
/* Output:
12
15
37
40
*/
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/