Quote:
|
Originally Posted by teknomage1
True but I'm assuming he's working on an exercise using char* arrays and is supposed to use addition functions to manipulate the characters. Since he's only adding 3, I doubt the variable will overflow. :-)
|
Adding only one can be enough to overflow a variable

Not that that is necessarily a bad thing for this particular excercise. Although you probably don't want \0 characters in the middle of a string, the post doesn't really say what to do when you add 3 to for example 'z'. My point would be that you should simply treat chars as chars.
C uses zero terminated arrays of chars, in C++ std::string is preferred. In C++ you'd use C++ streams with std::cin to get input, in C you have to read stuff from stdin, etc.
Just need more info.