How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string?
If you don't need to store it, you can reduce the time spent like this:
void showReverse(char s[], int length)
{
printf("Reversed String without storing is ");
//could use another variable to test for length, keeping length whole.
//assumes contiguous memory
for (; length > 0; length--)
{
printf("%c", *(s+ length-1) );
}
printf("\n");
}