How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / mahesh auti
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(void)
{
char str1[] = "Mahesh";
char str2[80], *p1, *p2;
clrscr();
p1 = str1 + strlen(str1) - 1;
p2 = str2;
while(p1 >= str1)
*p2++ = *p1--;
*p2 = '\0';
printf("%s %s", str1, str2);
getch();
return 0;
}
Is This Answer Correct ? | 26 Yes | 25 No |
Post New Answer View All Answers
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
What is array of structure in c?
What is an expression?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
In which language linux is written?
How can you increase the size of a dynamically allocated array?
What are the characteristics of arrays in c?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What are extern variables in c?
How do you list files in a directory?
Write a program to implement queue.
How can my program discover the complete pathname to the executable from which it was invoked?
How can you find the exact size of a data type in c?
What are the advantages of union?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?