/* scmp: string compare of *p1 and *p2 */ int scmp(const void *p1, const void *p2) { char *v1, *v2; v1 = *(char **) p1; v2 = *(char **) p2; return strcmp(v1, v2); } qsort passes to the comparing function a pointer to the elements it has to compare; s…