"Stack around the variable 'bar' was corrupted"?

This is a discussion on "Stack around the variable 'bar' was corrupted"? within the C++ Programming forums, part of the General Programming Boards category; In the function:
Code:
string ZipCode::zipToBar(int zip) { //Converts zip to bar code
int zipArr[5];
string ZERO = "11000",
ONE ...

Ahh, that was it! Thanks a lot for explaining all that, I'll definitely use it in the future

Here's a better tip for your programming life. Next time you write a simple program, step through the lines with a debugger and watch the variables change. It will get you used to using a debugger. Then when you get a segmentation fault in the future, the debugger will stop the code on the line where the segfault was raised. So there really isn't any point to writing a bunch of printf() lines or whatever. If the segfault didn't happen on that line, it probably happened in a lower level function.