MCPcopy Create free account
hub / github.com/WheretIB/nullc / BubbleSortArray

Function BubbleSortArray

tests/TestCallTransitions.cpp:33–50  ·  view source on GitHub ↗

sort array with comparator function inside NULLC

Source from the content-addressed store, hash-verified

31
32// sort array with comparator function inside NULLC
33void BubbleSortArray(NULLCArray arr, NULLCFuncPtr comparator)
34{
35 int *elem = (int*)arr.ptr;
36
37 for(unsigned int k = 0; k < arr.len; k++)
38 {
39 for(unsigned int l = arr.len-1; l > k; l--)
40 {
41 nullcCallFunction(comparator, elem[l], elem[l-1]);
42 if(nullcGetResultInt())
43 {
44 int tmp = elem[l];
45 elem[l] = elem[l-1];
46 elem[l-1] = tmp;
47 }
48 }
49 }
50}
51
52// function calls internal function
53void RecallerCS(int x)

Callers

nothing calls this directly

Calls 2

nullcCallFunctionFunction · 0.85
nullcGetResultIntFunction · 0.85

Tested by

no test coverage detected