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
Write a program to swap two numbers without using third variable in c?
What is an lvalue?
What is the code for 3 questions and answer check in VisualBasic.Net?
What is a static variable in c?
Tell me what are bitwise shift operators?
What is quick sort in c?
What is new line escape sequence?
In c programming language, how many parameters can be passed to a function ?
What is unary operator?
Is anything faster than c?
Is Exception handling possible in c language?
What is a pointer on a pointer in c programming language?
What is meant by int main ()?
How does free() know explain how much memory to release?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.