CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    90

    Question 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

  2. #2
    Join Date
    Feb 2002
    Posts
    5,757
    One solution is a temporary variable and some breakpoints.

    int nTemp = 0;

    ...
    nTemp = a[i][j];

    Kuphryn

  3. #3
    Join Date
    Jun 2002
    Location
    Germany
    Posts
    1,557
    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.

  4. #4
    Join Date
    Aug 2003
    Posts
    90
    yes...thanks....it is working

  5. #5
    Join Date
    Sep 2000
    Location
    Russia
    Posts
    262
    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
  •  





Click Here to Expand Forum to Full Width

Featured