Removing junk from end of string
Hello everyone. I've been working a lot with character arrays lately, but I cant seem to get something right. When I allocate some memory for a string (char *string=new char), it will fill it up with random characters. Then, when I copy part of another string into that one, it will copy over, but it still leaves all of the random junk at the end of the string. I've tried setting the character after the copied string in 'string' to 'NULL' and '\0', but it still just left all the junk in there. So, is there something im missing with this, ive been using character arrays for some time, but just recently ran into this problem. Thanks.