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 do you print only part of a string?
What are the different data types in C?
I have a varargs function which accepts a float parameter?
How can I automatically locate a programs configuration files in the same directory as the executable?
On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
What is the difference between text files and binary files?
can anyone suggest some site name..where i can get some good data structure puzzles???
Explain the difference between structs and unions in c?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
What is printf () in c?
What is structure in c definition?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
What is queue in c?
What is array of structure in c?