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
what are bit fields? What is the use of bit fields in a structure declaration?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
In a switch statement, what will happen if a break statement is omitted?
What is the meaning of 2d in c?
What is derived datatype in c?
Why n++ execute faster than n+1 ?
What is a macro?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
What is pointer to pointer in c?
What is the meaning of ?
Why are all header files not declared in every c program?
How arrays can be passed to a user defined function
What are the types of variables in c?
What does nil mean in c?
What is union in c?