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

View File

@ -11,10 +11,10 @@
#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
int start = 0, end = (int)n - 1;
int start = 0, end = n - 1;
if (arr[start] > target || arr[end] < target) return -1;
int mid = (start + end) / 2;

View File

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

View File

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

View File

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