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
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
What is a null pointer in c?
What is the condition that is applied with ?: Operator?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
Explain what is the most efficient way to store flag values?
What is a void pointer in c?
Once I have used freopen, how can I get the original stdout (or stdin) back?
What is the size of a union variable?
When a c file is executed there are many files that are automatically opened what are they files?
Explain how can I convert a number to a string?
What is default value of global variable in c?
What is an expression?
What 'lex' does?
Are c and c++ the same?
What are local variables c?