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...

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

Answer Posted / billy

string reverse with out recursion


void rev( char *p )
{

char tmp;
int len =strlen(p)-1;
for( int i=0 ; i <= len/2 ; i++ )
{


tmp = p[i] ;
p[i] = p[len - i ] ;
p[len - i ] = tmp ;
}


printf("%s",p);


}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none

1186


What is a null pointer in c?

1126


What is the condition that is applied with ?: Operator?

1072


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

1020


Explain what is the most efficient way to store flag values?

1176


What is a void pointer in c?

1046


Once I have used freopen, how can I get the original stdout (or stdin) back?

1033


What is the size of a union variable?

1003


When a c file is executed there are many files that are automatically opened what are they files?

1040


Explain how can I convert a number to a string?

1102


What is default value of global variable in c?

941


What is an expression?

1003


What 'lex' does?

1104


Are c and c++ the same?

1007


What are local variables c?

963