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
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
What is the difference between single charater constant and string constant?
Linked lists -- can you tell me how to check whether a linked list is circular?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
What does %c mean in c?
Explain heap and queue.
How do you use a 'Local Block'?
How variables are declared in c?
Explain how can you restore a redirected standard stream?
what is a function method?give example?
What are comments and how do you insert it in a C program?
What is fflush() function?
What are loops c?
What is c method?
Tell me what is null pointer in c?