Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
In Visual Studio 2005, how can I run until a variable changes?
I have a loop in my program. At the beginning of the loop, a certain variable consists of letters. At the end of the loop, the loop consists of digits. Inside the loop, I never intentionally change the variable-- I believe it's getting "stepped" on. I process this loop more than a thousand times when I run the program, so it would not be economical for me to trace the program through to the iteration in which the variable is getting changed (and I don't know which iteration it is, anyway). I'd like to put a "watch" on the variable (which I've already done, actually) and then run the program until the variable changes so I can see where it's accidentally getting stepped on.
How do you do this in Visual Studio 2005? It's a C++ program, if that makes any difference at all.
OOPS! I meant, "At the end of the loop, the VARIABLE consists of digits", not "the loop". Sorry!
1 Answer
- 1 decade agoFavorite Answer
Have you tried using a breakpoint in the IDE when you are debugging your code? You COULD see what iteration it changed on in runtime if that isn't possible.
Pseudocode...
bool initialStore = 1;
iteration = 0
do
iteration++
if initialStore = 1
// Store initial variable
initialstore = 0
else if initalStore = 0 AND var != initVar
print iteration
loop