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

Answer Posted / rahul kumar

/* Program to reverse any string input by the user without
using library function strlen( );*/

#include <stdio.h>
#include<conio.h>
void main()
{
char a[]={"sixaN: you are with us or against us"};
int i,len=0;
char *b;
clrscr();
b=a;
while(*b!='\0')
{
len++;
b++;
} //counting lenght of string

for(i=len;i>-1;i--)
printf("%c",a[i]); //printing charachters in reverse
getch();


Output :

su tsniaga ro su htiw era uoy :Naxis

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between linking and loading?

911


What are keywords in c with examples?

849


What is a wrapper function in c?

856


Explain about C function prototype?

852


What is the difference between printf and scanf in c?

1028


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1763


Write a function that will take in a phone number and output all possible alphabetical combinations

834


Why main function is special give two reasons?

1240


What is atoi and atof in c?

831


Is a house a shell structure?

922


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

2017


Why is event driven programming or procedural programming, better within specific scenario?

2183


What is a example of a variable?

784


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1415


What are qualifiers?

826