From 466cb48e2807804dbc472443a82a5d42f047708d Mon Sep 17 00:00:00 2001 From: Abdoul Malik Date: Thu, 23 Mar 2017 14:54:44 +0100 Subject: [PATCH] Add a other way to sort array with bubble Method --- OtherBubbleSort.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 OtherBubbleSort.c diff --git a/OtherBubbleSort.c b/OtherBubbleSort.c new file mode 100644 index 00000000..dad8e95e --- /dev/null +++ b/OtherBubbleSort.c @@ -0,0 +1,35 @@ +#include +#include +#define MAX 20 +#define TRUE 1 +#define FALSE 0 + + +int main() +{ + + int i , arraySort[MAX] ={0} , isSort = FALSE, changePlace; + + while(isSort) + { + isSort = FALSE; + + for( i = 0 ; i < MAX - 1 ; i++) + { + if(arraySort[i] > arraySort[i+1]) + { + changePlace = arratSort[i]; + arraySort[i] = arraySort[i+1]; + arraySort[i+1] = changePlace ; + isSort = TRUE; + } + + } + + + + + + return EXIT_SUCCESS; + +}