I am using char* stringl = newchar[templength];
to create a dynamic array with the size templength
From debugging in visual studio, it quite clearly shows that templength is 27, however the array that is created contains 33 characters (meaningless characters)
When i come to write characters to the array and display its contents, i'm consistantly left with jumbled characters after what i want to display,
Any insight as to why this is happening? =/
How do you know it has 33 chars? If you've asked for 27, you are given 27.
Microsoft's debug heap provides guard bytes on each allocation so it can help you find heap errors. It's a standard technique there to help you. It is not an error.
Its fine now, ive been able to place it into a string and resize the string, but still...
In debugger, by vewing the contents of the array, it actually does contain 33 characters, random ones that i then define, but the extra ones remain random
As kbw said, they aren't random characters. They're there for debug purposes. This is why debug builds are physically larger than release builds. It should have zero impact on your code though.