Technical Interview

Home
Technical Interview
Interview Process
Introduction Questions
Quantitative Problems
Google & Microsoft
Algorithms
Object Oriented
C/C++ Questions
Java Questions
Data Structures
Fundamental Questions
Puzzles
Resume Tips
Added Recently
Links
Contact Us
Submit Question/Answer

 

   
Reverse a string. Write a C/C++ program.




   


 

Solutions:

 

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--;

}

}