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

Simplify the program segment if X = B then C ← true else C ← false

1960


Write a code to generate divisors of an integer?

23


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

16


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1000


What math functions are available for integers? For floating point?

3






What is a keyword?

11


Is there a way to compare two structure variables?

7


write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);

1147


What is the advantage of an array over individual variables?

26


how to construct a simulator keeping the logical boolean gates in c

1008


Explain how can I right-justify a string?

4


the maximum value that an integer constant can have is a) -32767 b) 32767 c) 1.701e+38 d) -1.7014e+38

17


What is character set?

12


#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }

26


What is unary operator?

9