Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to reverse a string using a recursive function, without
swapping or using an extra memory?

Answer Posted / cmp

#include <stdio.h>
void print(char *s,int size){
if(size<0)
printf(" ");
else

{
printf("%c",*(s+size-1));
print(s,size-1);
}
}

void main(){
char *s={"aliveli"};
int size=0,i=0;

while(*(s+i)!='\0'){
size++;
i++;
}
print(s,size);
}

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to find a missed value, if you want to store 100 values in a 99 sized array?

1414


What is the difference between functions abs() and fabs()?

1157


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

1123


Is there any possibility to create customized header file with c programming language?

1065


What is the difference between pure virtual function and virtual function?

1122


What is structure and union in c?

1151


How can I pad a string to a known length?

1034


What is struct node in c?

1075


Is it better to use malloc() or calloc()?

1116


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3970


Why array is used in c?

1016


What is a pointer in c plus plus?

1311


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

1261


Does c have an equivalent to pascals with statement?

1006


What is the scope of an external variable in c?

1050