#include <iostream>
usingnamespace std;
template <typename T>
void printArray( const T * const array, int count)
{
for ( int i = 0; i< count; ++i)
cout << array[i] << " ";
cout << endl;
}
int printArray( const T * const array, int lowSubscript, int highSubscript)
{
int lowSubscript;
int highSubscript;
if (highSubscript > lowSubscript)
for ( int i = lowSubscript; i < highSubscript; ++i)
{
cout << array[i] << " ";
cout << endl;
}
if (lowSubscript > highSubscript)
return 0;
}
The first function works fine and I am able to print using it. I am trying to overload it by passing two integers that are supposed to be part of an array. The function should print the elements located in between those two values and return 0 if the low value is higher than the high value.
The following are the errors I am getting:
1 2 3
fig14_01.cpp(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
fig14_01.cpp(15) : error C2143: syntax error : missing ',' before '*'
fig14_01.cpp(24) : error C2065: 'array' : undeclared identifier