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
When should the const modifier be used?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is difference between static and global variable in c?
Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent
what is use of malloc and calloc?
What are data structures in c and how to use them?
What are the types of arrays in c?
What is the importance of c in your views?
What is the use of typedef in c?
How do c compilers work?
Why we use stdio h in c?
regarding pointers concept
Explain the meaning of keyword 'extern' in a function declaration.
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?