How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / aditi parab
#include <stdio.h>
int main ()
{
int i,j;
char a[10];
char temp;
//clrscr (); // only works on windows
gets(a);
for (i=0;a[i]!='\0';i++);
i--;
for (j=0;j <= i/2 ;j++)
{
temp = a[j];
a[j] = a[i-j];
a[i-j] = temp;
}
printf("%s",a);
return(0);
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
what is different between auto and local static? why should we use local static?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What is an operator?
Find MAXIMUM of three distinct integers using a single C statement
Is that possible to add pointers to each other?
What functions are used in dynamic memory allocation in c?
What is the use of bit field?
What is substring in c?
What is the advantage of a random access file?
How do you list files in a directory?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
Explain how can you restore a redirected standard stream?
List out few of the applications that make use of Multilinked Structures?
What is || operator and how does it function in a program?
How do you write a program which produces its own source code as output?