write a C code
to reverse a string using a recursive function, without
swapping or using an extra memory.

Answer Posted / sanny

#include<stdio.h>
#include<conio.h>
main()
{
int num, rem=0;
printf("\n Enter the number ");
scanf("%d", &num);
while(num>0)
{
rem = (rem * 10) + (num % 10);
num = num / 10;
}
printf("\n Reverse of the number is %d", rem);
getch();
}

Is This Answer Correct ?    10 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c easier than java?

581


How to explain the final year project as a fresher please answer with sample project

476


Who invented b language?

925


What is the difference between NULL and NUL?

733


What is a #include preprocessor?

629






When is a null pointer used?

646


What is the difference between arrays and pointers?

638


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]

636


What is memcpy() function?

626


What is the difference between array and linked list in c?

610


What is the explanation for the dangling pointer in c?

684


Explain how does flowchart help in writing a program?

638


What is pointers in c?

667


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1265


What are the advantages of using linked list for tree construction?

651