ashishkadam0220 0 Newbie Poster
Recommended Answers
Jump to PostMinor issue AD. You are starting at the terminating null byte and then ending at the head of the string. Better this I think:
for(int i = len-1, j = 0; i >= 0; --i, ++j) { target[j] = source[i]; } target[len] = 0; // Properly terminate …
Jump to PostThe question does not seem to preclude the use of a human processor so how about
#include <string> #include <iostream> int main() { std::string text; std::string reversed; std::cout << "Please enter the string to reverse: " << std::flush; std::getline(std::cin, text); std::cout << std::endl; std::cout << "Please enter …
All 7 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
Banfa 597 Posting Pro Featured Poster
rubberman commented: Great post Banfa! Nothing like leveraging stuff like the STL. +12
BobS0327 24 Junior Poster in Training
vmanes 1,165 Posting Virtuoso
Alexandr_1 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.