tags:

views:

967

answers:

1

Hello! I've got the dynamic array of pointers to structure.

struct item {
    unsigned long code;     //1 - 2^32
    unsigned short date;    //0 - (13*365+4-31)+1
    unsigned char place;    //1 - 200
    unsigned short amount;  //0 - 10000
    unsigned short price;   //0 - 50000
};

count = getSizeFromSomewhere();

item ** x=new item * [count]; //real used array
item * y[10];  //just for example

When I'm debugging this code in Xcode, I'm able to watch each element of y array and corresponding values of item structure. But In x array I can't watch anything, excepting first element (and corresponding item structure).

Is there any way to watch x as array of pointers (as i did with y).

Thanks a lot.

+1  A: 

Since memory for 'x' is dynamically allocated at compile time complier doesn't know about the size of the array. But 'y' is allocated on stack and it can easily figure out its size. Because of this you will not be able to watch the 'x' as you can watch 'y'. The simplest way to watch the 'x' will be to add a watch for x[i] where i = 0..count-1

Naveen