#include<iostream>
using namespace std;
template<class T>
void arrayReverse(T *a,int begin,int end)
{
int tmp;
for(;begin<end;begin++,end--)
{
tmp = *(a+begin);
*(a+begin) = *(a+end);
*(a+end) = tmp;
}
}
template<class T>
void Output(T *a,int len)
{
int i;
for(i = 0;i<len;i++)
{
cout<<*(a+i)<<" ";
}
cout<<endl;
}
int main()
{
int src[12] = {1,2,3,21,22,23,41,42,43,81,82,83};
//char src[13] ="luochuaningo";
int flag = 6;
Output(src,12);
arrayReverse(src,0,flag-1);
Output(src,12);
arrayReverse(src,flag,11);
Output(src,12);
arrayReverse(src,0,11);
Output(src,12);
return 0;
}
using namespace std;
template<class T>
void arrayReverse(T *a,int begin,int end)
{
int tmp;
for(;begin<end;begin++,end--)
{
tmp = *(a+begin);
*(a+begin) = *(a+end);
*(a+end) = tmp;
}
}
template<class T>
void Output(T *a,int len)
{
int i;
for(i = 0;i<len;i++)
{
cout<<*(a+i)<<" ";
}
cout<<endl;
}
int main()
{
int src[12] = {1,2,3,21,22,23,41,42,43,81,82,83};
//char src[13] ="luochuaningo";
int flag = 6;
Output(src,12);
arrayReverse(src,0,flag-1);
Output(src,12);
arrayReverse(src,flag,11);
Output(src,12);
arrayReverse(src,0,11);
Output(src,12);
return 0;
}