Debugging arrays in the Watch Window


  • I'm using Microsoft Visual C++ version 7, and I have an array in my code. I would like to be able to see the elements of the array in the Watch window as I am debugging. Right now, if I want to see the elements of the array, I have to enter in the individual elements on separate lines like:

    If I only put in the name of the array like:
    then there is a plus sign next to it, and when I expand it, I can see the first element of the array only. Is there a way to view the elements of the array without entering each one in on separate lines?

    Below is some of my actual code:
    //create new "shiftedarray"
    int * shiftedarray = new int [ n ];

    //store currentarray in shifted array
    for(int i = 0; i < n; i++){
    shiftedarray[ i ] = currentarray[ i ];

    In the Watch Window I have entered "shifted array" and it looks like this:
    Name Value Type
    - shiftedarray 0x00333ca8 int *
    1 int

    But it won't show me any more than the first element of "shiftedarray" even when I expand it.

    Wednesday, August 09, 2006 8:07 PM


All replies