hey no one of u can understand wat em i talking bout
I have the general idea, but passing a "sub-array", if you will, is not quite right. Rather, you should pass pointers to a range in the array.
Consider the approach demonstrated in this program:
Code:
#include <iostream>
void print(int* begin, int* end);
int main()
{
int[] numbers = {0,1,2,3,4,5,6,7,8,9};
// Pass pointers to the array to denote a range.
// (numbers + 3) is the start of the range {3,4,5}
// (numbers + 6) is one past the end of the range
print(numbers + 3, numbers + 6);
}
// Prints range denoted by [begin, end).
void print(int* begin, int* end)
{
for (int* i = begin; i != end; ++i)
{
std::cout << *i << " ";
}
std::cout << std::endl;
}