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
I need a sort of an approximate strcmp routine?
What is the difference between the expression “++a” and “a++”?
What does %p mean?
Where static variables are stored in c?
What is modifier & how many types of modifiers available in c?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
What is structure in c definition?
What is context in c?
When should the register modifier be used? Does it really help?
What is size of union in c?
Explain how can you avoid including a header more than once?
Explain output of printf("Hello World"-'A'+'B'); ?
what do you mean by inline function in C?
What is #include stdlib h?
What is the explanation for modular programming?