How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / cmp
#include <stdio.h>
void print(char *s,int size){
if(size<0)
printf(" ");
else
{
printf("%c",*(s+size-1));
print(s,size-1);
}
}
void main(){
char *s={"aliveli"};
int size=0,i=0;
while(*(s+i)!='\0'){
size++;
i++;
}
print(s,size);
}
Is This Answer Correct ? | 6 Yes | 5 No |
Post New Answer View All Answers
What is operator promotion?
What is string concatenation in c?
Is c a great language, or what?
a program that can input number of records and can view it again the record
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
Can include files be nested? How many levels deep can include files be nested?
Do you know the purpose of 'register' keyword?
define string ?
What is floating point constants?
Explain zero based addressing.
How to write c functions that modify head pointer of a linked list?
What is the purpose of sprintf?
How many parameters should a function have?
What are the salient features of c languages?
Why cant I open a file by its explicit path?