You compare the contents of two strings with the strcmp function in the header. What you're actually doing with the == operator is comparing two memory addresses. Since the two strings are extremely unlikely to be located at the same address, your comparison will fail and the sort will always be in ascending order.
Include and change this:
if (argv[1] == FLAG)
to this:
if (strcmp(argv[1], FLAG) == 0)
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401