Skip to content

Instantly share code, notes, and snippets.

@Nydhal
Last active November 21, 2017 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nydhal/fcd5030b17c5275e6bff18cb027766d5 to your computer and use it in GitHub Desktop.
Save Nydhal/fcd5030b17c5275e6bff18cb027766d5 to your computer and use it in GitHub Desktop.
bubble sort in C
void sortStrings(char strings[NUM_STRINGS][STRING_LENGTH]){
for (int i = 0; i < NUM_STRINGS-1 ; i++){
for (int j = 0; j < NUM_STRINGS-i-1; j++){
if (strcmp(strings[j],strings[j+1])>0) {swapStrings(strings[j], strings[j + 1]);
}}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment