-
December 29th, 2003, 10:40 AM
#1
debugging problem
hi , i wanted to see the value of an array inside a loop at the time of debugging.
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
a[i][j] = some value;
this a[i][j] i wanted to see at the DEBUG WATCH WIDOW .
i wrote at the watch name
a[i][j] ---> error symbol.!!!!!!
i wrote also simply the name a ---->error symbol !!!!!!
my question is if i want to see the array value what i have to write in the watch window????
thanks
-
December 29th, 2003, 11:25 AM
#2
One solution is a temporary variable and some breakpoints.
int nTemp = 0;
...
nTemp = a[i][j];
Kuphryn
-
December 29th, 2003, 11:40 AM
#3
Mummy,
To elaborate on what kuphryn said, look at the sample below. The course of action is indicated in the comment in the source code. You can examine a[0], a[1], etc. using the MSVC debugger.
Good luck.
Sincerely, Chris.
Code:
int main(int argc, char* argv[])
{
int val = 0;
int a[8][8];
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
// Put a breakpoint here and look at a[0], a[1], etc.
a[i][j] = val++;
}
}
return 0;
}
You're gonna go blind staring into that box all day.
-
December 29th, 2003, 12:58 PM
#4
yes...thanks....it is working
-
January 8th, 2004, 09:43 PM
#5
I consider your 'a' variable was static
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
|