Memory problems (?)
(this is actually a c++ program, but the C++ board obviously deals more with gui stuff)
I am writing a program where I have tree structure, and I have a private char array
char binPath ;
and whenever I run the program, it crashes. when I comment out the declaration line, it works fine. Why?
I have tried using a pointer, and didn't have very much more luck.
My program uses the huffman compression to compress a text file. I want to store a [binary] path to each leaf in the tree. I wanted to store this path in a char array (or pointer), with 1's and 0's, but is there a more memory efficient way?
This should be on the C++ board. Doubtless a moderator will move it over there for you, so don't cross-post. Your error is likely in another spot in your program, and what you're seeing is behavior that's a side effect of it. I suspect you're blowing past an array, or using an uninitialized pointer or what not, which happend to be trying to use your protected array because that's where it just happens to be accessing when that's in.
In the future, consider posting more of your code. You'll also want to consider using a stripped down version of your class to test out the situation. Example, if you have a class that has some twenty member functions, and they all work, but one doesn't, try creating a class just for that function, and once you've got that fixed, then integrate the function into the big class again. (Once you know your logic and code is correct on a small scale.)
> (this is actually a c++ program, but the C++ board obviously deals more with gui stuff)
No, it should be on the C++ board
Overty GUI stuff gets moved to the windows board, if that is the kind of GUI it refers to