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 are multidimensional arrays?
What will be the outcome of the following conditional statement if the value of variable s is 10?
Explain the difference between exit() and _exit() function?
Do you know the purpose of 'register' keyword?
Is it cc or c in a letter?
How can I determine whether a machines byte order is big-endian or little-endian?
What is wild pointer in c with example?
What is the difference between malloc() and calloc()?
What does the function toupper() do?
How macro execution is faster than function ?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
What is chain pointer in c?
What is strcmp in c?
Is null a keyword in c?
What is merge sort in c?