I wrote this piece of code to test a function I would be using in a larger program. Basically, there's a function that takes a character and converts it to an integer (a=1, b=2, etc.), and after that, in the main method, I define a string and, using the function I previously defined, convert the whole string to an array of integers. I then try to print that array to the screen, but as of now the output I get is this:
0x22fe60
@Archaic:
I just deleted all my compilation tools so I could later update them, so I can't verify this statement, but I'm pretty sure that myStr.size() returns a value that doesn't echo back through time and change itself.
Okay, I'm just kidding. But seriously, C++ would be quite dull if you couldn't dynamically allocate stuff.
*Why do I insist on upgrading to GCC 4.5? 4.2.1 is what Apple offers and it worked for the longest time...*
Another detail @jarke: Your function is... overblown. Sorry, but there's another way of doing this that results in shorter and faster code. Characters can be converted directly to integers and back. This is a table of values that each character represents: http://www.danshort.com/ASCIImap/
Just subtract 64 from your character to get your int and you're ready to roll.