How to reverse a string using a recursive function, without
swapping or using an extra memory?

Answer Posted / mahendra aseri

Reverse a string

void ReverseString (char *String)
{
char *Begin = String;
char *End = String + strlen(String) - 1;
char TempChar = '\0';

while (Begin < End)
{
TempChar = *Begin;
*Begin = *End;
*End = TempChar;
Begin++;
End--;
}
}

Is This Answer Correct ?    24 Yes 27 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1434


Explain about block scope in c?

865


What is the sizeof () operator?

803


Explain continue keyword in c

787


What is a substring in c?

808


Is there a way to compare two structure variables?

865


What is null pointer in c?

772


What are the different types of data structures in c?

868


Explain what is the difference between the expression '++a' and 'a++'?

893


Who invented bcpl language?

943


what are non standard function in c

1664


Differentiate between ordinary variable and pointer in c.

870


What is the purpose of clrscr () printf () and getch ()?

807


how to write optimum code to divide a 50 digit number with a 25 digit number??

3019


What is wrong in this statement? scanf(“%d”,whatnumber);

996