Tag Archives: Pass

Pass a STL Array of fixed size as a parameter to another function without declaring the size in the function signature or prototype

There are two ways of doing this. You can either pass in a pointer/reference to the array along with it’s size to the function. #include <iostream> #include <array> void swap(int *arr, int a, int b) { auto t = arr[a]; arr[a] = arr[b]; arr[b] = t; } int partition(int *arr, int low, int high) { […]

0