code cleanup & fixed syntax error

This commit is contained in:
Krishna Vedala 2020-04-07 18:29:24 -04:00
parent a3989bbadc
commit cee2468506
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7

View File

@ -4,24 +4,20 @@
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
int main() int main()
{ {
int i, arraySort[MAX] = {0}, isSort = FALSE, changePlace; int i, arraySort[MAX] = {0}, isSort = FALSE, changePlace;
/* For example /* For example
Insertion random values in array to test Insertion random values in array to test
*/ */
for (i = 0; i < MAX; i++) for (i = 0; i < MAX; i++)
{ {
arraySort[i] = rand() % 101; arraySort[i] = rand() % 101;
} }
/* Algorithm of bubble methods */ /* Algorithm of bubble methods */
while (isSort) while (isSort)
@ -32,12 +28,11 @@ int main()
{ {
if (arraySort[i] > arraySort[i + 1]) if (arraySort[i] > arraySort[i + 1])
{ {
changePlace = arratSort[i]; changePlace = arraySort[i];
arraySort[i] = arraySort[i + 1]; arraySort[i] = arraySort[i + 1];
arraySort[i + 1] = changePlace; arraySort[i + 1] = changePlace;
isSort = TRUE; isSort = TRUE;
} }
} }
} }
@ -48,9 +43,5 @@ int main()
printf("%d\n", arraySort[i]); printf("%d\n", arraySort[i]);
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }