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
State the difference between x3 and x[3].
What is the use of bit field?
What is array of pointers to string?
What is action and transformation in spark?
This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
What is the use of typedef in c?
What are the types of unary operators?
What do you mean by scope of a variable in c?
What is the argument of a function in c?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is string length in c?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
What are the advantages of the functions?
What is character set?