oh and i just tried strncmp for the sake of it. It finds the lexicographically smallest element in my list but i dont exactly want that.
Now comparing a char to another char works (i.e. which ever ones smaller) but it doesn't work on a whole string.
and the following doesn't work (it should return a numerical value so i can compare if the string is smaller(i.e. if it comes alphabetically with the one i'm comparing to).
if (current->next->cityname < start->cityname)
printf("%s %s %s", "\nFound a smaller character", start->next->cityname, "\n");
printf argument mismatch for format d. Expected int got pointer to char
How can i compare if a whole string comes first alphabetically?
Denmark 28.80 17.60
Bahamas 5.60 79.12
Canada 55.30 49.90
Antarctica 22.22 11.11
Antarctica is the smallest in this case.
and just an example where i was comparing the current element to the next
char b = 'B';
char a = 'A';
if (b > a)
printf("It's greater in value, therefore it should be swapped.");