Possible Duplicate:
C++ Reverse Array
How can I reverse a character array? Like this:
char word1[10] = "this";
char word2[10] = word1[10] // in reverse
cout<<word2; // I want it to output "siht"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How about a simple loop (since i do not know the exact type of
word1andword2)?I highly suggest that you use
std::stringinstead ofchar. There are plenty of answers on how to do this withstd::stringhere.