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

State the difference between x3 and x[3].

1052


What is the use of bit field?

1116


What is array of pointers to string?

1000


What is action and transformation in spark?

1082


This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory

1200


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

1018


What is the use of typedef in c?

990


What are the types of unary operators?

1128


What do you mean by scope of a variable in c?

972


What is the argument of a function in c?

991


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2412


What is string length in c?

1026


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

2245


What are the advantages of the functions?

1096


What is character set?

1118