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
What is malloc calloc and realloc in c?
What is the difference between c &c++?
Differentiate between functions getch() and getche().
What is clrscr in c?
Explain the properties of union. What is the size of a union variable
Why doesnt this code work?
Is c programming hard?
How can I get the current date or time of day in a c program?
What is a example of a variable?
Ow can I insert or delete a line (or record) in the middle of a file?
Explain what math functions are available for integers? For floating point?
Why is c used in embedded systems?
What is array of structure in c?
What is the maximum length of an identifier?
What is main () in c?