1
1
mirror of https://github.com/RolandWH/ceesort.git synced 2025-03-15 21:31:36 +00:00

switch from size_t to int for arr sizes

This commit is contained in:
Roland W-H 2022-05-29 18:23:10 +01:00
parent 063a229f3a
commit 8b200c099f
4 changed files with 5 additions and 5 deletions

@ -11,10 +11,10 @@
#include <stddef.h> #include <stddef.h>
int bsrch(int target, int* arr, size_t n) int bsrch(int target, int* arr, int n)
{ {
// TODO: Find a way to error if list is out of order // TODO: Find a way to error if list is out of order
int start = 0, end = (int)n - 1; int start = 0, end = n - 1;
if (arr[start] > target || arr[end] < target) return -1; if (arr[start] > target || arr[end] < target) return -1;
int mid = (start + end) / 2; int mid = (start + end) / 2;

@ -9,4 +9,4 @@
#include <stddef.h> #include <stddef.h>
int bsrch(int target, int* arr, size_t n); int bsrch(int target, int* arr, int n);

@ -10,7 +10,7 @@
#include <stdbool.h> #include <stdbool.h>
void bubblesort(int* arr, size_t n) void bubblesort(int* arr, int n)
{ {
bool swapped = true; bool swapped = true;

@ -9,4 +9,4 @@
#include <stddef.h> #include <stddef.h>
void bubblesort(int* arr, size_t n); void bubblesort(int* arr, int n);