How to reverse a string using a recursive function, without
swapping or using an extra memory?
Answer Posted / siva kumar
void reverse_string(char *string) {
static int start_index = 0;
static int end_index = strlen(string) - 1;
if (start_index <= end_index) {
char temp = string[end_index];
string[end_index] = string[start_index];
string[start_index] = temp;
start_index++;
end_index--;
reverse_string(string);
}
}
Is This Answer Correct ? | 11 Yes | 10 No |
Post New Answer View All Answers
What is chain pointer in c?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
How does normalization of huge pointer works?
How can you determine the size of an allocated portion of memory?
What is structure padding and packing in c?
What is this infamous null pointer, anyway?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
Explain what standard functions are available to manipulate strings?
Is Exception handling possible in c language?
What is indirection? How many levels of pointers can you have?
What are the disadvantages of a shell structure?
What is the symbol indicated the c-preprocessor?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
Sir i need notes for structure,functions,pointers in c language can you help me please
What is call by value in c?