mirror of
https://github.com/RolandWH/ceesort.git
synced 2025-03-14 20:31:36 +00:00
switch from size_t to int for arr sizes
This commit is contained in:
parent
063a229f3a
commit
8b200c099f
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user