How to reverse a string using a recursive function, without
swapping or using an extra memory?

Answer Posted / bret

void revDisplay (char a[])
{

if(strlen(a) != 0)
{
revDisplay(a+1);
cout << a[0];
}
}

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

556


When can you use a pointer with a function?

541


What is the purpose of ftell?

577


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

2625


State the difference between realloc and free.

607






In c programming language, how many parameters can be passed to a function ?

597


What is the use of getchar() function?

608


What do you mean by dynamic memory allocation in c?

624


write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.

14893


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2091


How are portions of a program disabled in demo versions?

717


What is sorting in c plus plus?

542


Define recursion in c.

676


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

837


Write programs for String Reversal & Palindrome check

574