i'm using eclipse and netbeans for c, and i'd like to check out the values of variables that are dynamically allocated in the memory when i'm debugging (both in eclipse and netbeans).
for some reason, i can only see the value of the pointer itself, and it's first item.
to illustrate: with this code:
int foo[10];
i can check the value of the entire array later on (when debugging). for example, i can check out the value of foo[7] in the watches window.
but with this code:
int *bar = malloc(10*sizeof(int));
i can only check out where bar
is pointing, and the value of bar[0]
(but not the other values).
how can i watch all the values of the array?
UPDATE: the issue was solved in both eclipse and netbeans.
in eclipse: right click the desired variable in the Variables window -> select Display As Array -> fill in the start index and the array length.
in netbeans: in the Watches window add a new watch with the following format:
*((bar)+0)@10
where bar
should be the pointer name,
0
should be your start index
and 10
should be its length
if i may add something personal: this is my first ever message on stackoverflow. i hope you found it useful.