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
How can I make sure that my program is the only one accessing a file?
What is the equivalent code of the following statement in WHILE LOOP format?
What are different storage class specifiers in c?
What is malloc calloc and realloc in c?
What are the parts of c program?
Differentiate between a for loop and a while loop? What are it uses?
What is difference between arrays and pointers?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
What is the difference between ++a and a++?
Differentiate between ordinary variable and pointer in c.
What is modeling?
Write a C program to count the number of email on text
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
Explain what is a stream?
Explain how do you search data in a data file using random access method?