use stdbool.h instead of manually defined macros

This commit is contained in:
northernSage 2021-02-17 07:11:11 -03:00
parent e2add348d9
commit 6b0f57d372

View File

@ -1,12 +1,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#define MAX 20 #define MAX 20
#define TRUE 1
#define FALSE 0 #include <stdbool.h>
int main() int main()
{ {
int i, array_sort[MAX] = {0}, is_sorted = FALSE, change_place; int i, array_sort[MAX] = {0}, is_sorted = false, change_place;
/* For example /* For example
Insertion random values in array to test Insertion random values in array to test
@ -21,7 +21,7 @@ int main()
while (is_sorted) while (is_sorted)
{ {
is_sorted = FALSE; is_sorted = false;
for (i = 0; i < MAX - 1; i++) for (i = 0; i < MAX - 1; i++)
{ {
@ -30,7 +30,7 @@ int main()
change_place = array_sort[i]; change_place = array_sort[i];
array_sort[i] = array_sort[i + 1]; array_sort[i] = array_sort[i + 1];
array_sort[i + 1] = change_place; array_sort[i + 1] = change_place;
is_sorted = TRUE; is_sorted = true;
} }
} }
} }