In the second edition of K & R, section 5.11, the comparison function
int numcmp(char *s1, char *s2);
used for digital sorting (as opposed to use strcmpfor lexicographic sorting). numcmpcalls a function
double atof(char s[]);
which converts the string to a double-precision floating-point equivalent.
In the example, sorting with a command line argument -nis done using the values doublereturned by the function atof.
mizo source
share