Skip to content

Conversation

@Gathros
Copy link
Contributor

@Gathros Gathros commented Apr 17, 2018

No description provided.

@@ -0,0 +1,41 @@
#include <stdio.h>

void bubble_sort(int *array, size_t n) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should probably include stddef.h here.

}

int main() {
int array[10] = {1, 45, 756, 4569, 56, 3, 8, 5, -10, -4};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use a #define instead of magic constants throughout the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's needed really, it's just an example.

@leios
Copy link
Member

leios commented Apr 18, 2018

@ubsan I do agree that a #define n 10 would help a bit for readability in both cases, actually.

@Gathros
Copy link
Contributor Author

Gathros commented Apr 18, 2018

@leios I get that but it's a part of the example and not the implementation of bubble sort.

@leios
Copy link
Member

leios commented Apr 18, 2018

yeah, I get that too. I think it's probably fine this way.

@leios leios merged commit 18ec728 into algorithm-archivists:master Apr 18, 2018
@leios
Copy link
Member

leios commented Apr 18, 2018

With this and #80, I think the array[10] is fine for now specifically because it's example code.

@Gathros Gathros deleted the CBubbleSortPR branch April 24, 2018 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants