-
July 2nd, 2008, 12:53 PM
#1
Debugging Arrays
Hi there,
I am debugging a 8*8 array.
When I view it in Auto or Locals and expand it all it shows is what I assume are the rows. the value for each row is simply shows as the memory location of the overall array.
Is there a way for me to view the whole array i.e. by column and row?
And to see the value stored in that location?
also I have a value which I a static int which does not show up in either Auto or Locals how can I view the value of this variable when the program is running?
-
July 2nd, 2008, 01:01 PM
#2
Re: Debugging Arrays
You'd need to expand the rows too,
Alternately you could use the watch or quick watch windows and type in something like myArray[1][2]
-
July 2nd, 2008, 01:03 PM
#3
Re: Debugging Arrays
I cannot expand the rows?
There is a box with a plus in it but nothing happens when I click on it?
-
July 2nd, 2008, 01:03 PM
#4
Re: Debugging Arrays
For dynamic-size arrays, you cannot expand an entire row by simply clicking next to it, since the debugger doesn't know how big it is. The syntax then would be,
myArray[1],2
in the watch window.
-
July 2nd, 2008, 01:09 PM
#5
Re: Debugging Arrays
Originally Posted by Lindley
For dynamic-size arrays, you cannot expand an entire row by simply clicking next to it, since the debugger doesn't know how big it is. The syntax then would be,
myArray[1],2
in the watch window.
ah that's it thanks to both of you!!!
can you exaplin to me the syntax though
the myArray[1] is obviously identifying the arrau and the row.
Also can anyone exaplain to me how to view variables of type static int?
It doesn't show up in either auto or locals and doesn;t seem to be doing its job in the program either!
-
July 2nd, 2008, 01:11 PM
#6
Re: Debugging Arrays
Just type the name of the variable in the watch window. If the var is within scope it should show you the value.
-
July 2nd, 2008, 01:13 PM
#7
Re: Debugging Arrays
ahhhh
It come sup with!
step: CXX0017: Error: symbol "step" not found
below is the code, why would this symbol not be found?
Code:
void updateMove(int board[][8],int moves[],int choice,int& x,int& y, int& movecounter)
{
static int step =0;
step += 10;
movecounter += 1;
board[x += horizontal[moves[choice]]][y += vertical[moves[choice]]] = step;
}
-
July 2nd, 2008, 01:20 PM
#8
Re: Debugging Arrays
Which line was the debugger stopped on when it said that?
-
July 2nd, 2008, 01:22 PM
#9
Re: Debugging Arrays
It is just on the closing brace.
But I have not Pressed F11 to proces it yet.
All other variables within that bloack are still viewable.
-
July 2nd, 2008, 01:44 PM
#10
Re: Debugging Arrays
Does it show up if you breakpoint before the closing brace?
-
July 2nd, 2008, 01:54 PM
#11
Re: Debugging Arrays
no it has the same error:
step CXX0017: Error: symbol "step" not found
mo matter where you are in the program.
-
July 2nd, 2008, 02:05 PM
#12
Re: Debugging Arrays
Make sure optimization is disabled.
-
July 2nd, 2008, 02:06 PM
#13
Re: Debugging Arrays
sorry what is optimsiation and how do I disable it?
-
July 2nd, 2008, 02:08 PM
#14
Re: Debugging Arrays
Project->Properties->C/C++->Optimization and set the first option to "Disabled". This should be the case by default in the Debug configuration.
-
July 2nd, 2008, 02:12 PM
#15
Re: Debugging Arrays
OK I'm usig VC++ 6
In Project settings>C/C++>under optimisations: it has Diable(debug) but this is ghosted out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|