0

Background: I learned old-school c++ programming techniques, being able to declare global variables before the main() routine.

However, in Vis C++, I am having trouble, especially with global arrays. I am programming a Windows Forms application. In it, I declare a global integer array just after all my includes in the top of form1.h. Next, the contents of the array are modified during a button-click event function.

The problem: inside another button-click event function, the same global array's contents are scrambled, containing random numbers. I've experimented with using "public:" in the declarations, to no avail.

Any suggestions would be greatly appreciated. Thanks!

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by truetexan
0

funny, the phenomenon that happens when you ask for help... all the sudden the anwer becomes obvious. Well, after printing the arrays to a file, the data proved to be correct. So, it turns out that my code is working, but for some goofy reason, the watches for these arrays aren't. After a breakpoint in the function where I print the correct global array data to a file, the watches still show erroneous data for these global arrays. Since I assumed watches don't lie, it let me on a 5-day rabbit chase. I've used watches in other software, never having trouble. Anyone else run into faulty watches? OK, I'll try to copy some code to the thread.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.