Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define strcmpi strcasecmp
- int main () {
- char names[5][255] = {
- "asd", "ASD", "qwe", "aasd", "qwcf"
- };
- // bubble sort
- int i = 0;
- do {
- int j = 0;
- do {
- if (strcmpi(names[i], names[j]) < 0) {
- char name[255];
- strcpy(name, names[i]);
- strcpy(names[i], names[j]);
- strcpy(names[j], name);
- }
- ++j;
- } while (j < 5);
- ++i;
- } while (i < 5);
- for (int i = 0 ; i < 5 ; ++i) {
- printf("%s ", names[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement