Reverse an array without using a loop???
March 3rd, 2010
Hiring a programmer? Ask these questions in the interview | IT Leadership | TechRepublic.com
Reverse an array without using a loop
I read the article and tried to make the program.
I am not sure if this is correct. Let me know what you think.
rev(&myarray[0], &newarray[0], size);
}
void rev(int* oldArray, int* newArray, int num)
{
int* next= oldArray;
num–;
if (num>1)
{
next++;
rev(next, num);
}
*newArray = *oldArray;
newArray++;
}
Recent Comments