Skip to content

Commit 8b741f4

Browse files
committed
Removed the 'stdbool' header file and updated code
I realized we were barred using any other standard library so I removed the one I added.
1 parent 16c54b7 commit 8b741f4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

2-selection_sort.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
void selection_sort(int *array, size_t size)
1111
{
1212
size_t i, j, cur_min;
13-
bool min_found; /* tracks whether a lesser value is found */
13+
int min_found; /* tracks whether a lesser value is found */
1414

1515
/* there's no need to perform sorting on empty or one-element arrays */
16-
if (size == 0 || size == 1)
16+
if (array == NULL || size < 2)
1717
return;
1818

1919
for (i = 0; i < size - 1; i++)
2020
{
2121
cur_min = i;
22-
min_found = false;
22+
min_found = 0;
2323

2424
for (j = i + 1; j < size; j++)
2525
{
2626
if (array[j] < array[cur_min])
2727
{
2828
cur_min = j;
29-
min_found = true;
29+
min_found = 1;
3030
}
3131
}
3232

sort.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <stdio.h>
55
#include <stdlib.h>
6-
#include <stdbool.h>
76

87
/**
98
* struct listint_s - Doubly linked list node

0 commit comments

Comments
 (0)