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

Why c is called a mid level programming language?

833


in iso what are the common technological language?

1861


What are the standard predefined macros?

826


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1715


What are the key features in c programming language?

823


Array is an lvalue or not?

857


What are the 3 types of structures?

768


Can we initialize extern variable in c?

868


Write a program on swapping (100, 50)

865


With the help of using classes, write a program to add two numbers.

842


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

874


What is indirection? How many levels of pointers can you have?

908


Describe the steps to insert data into a singly linked list.

824


In C, What is the #line used for?

1516


How does placing some code lines between the comment symbol help in debugging the code?

766