Looking into dynamic variables created using pointers?

89 views Asked by At

I was wondering if there is a tool in any IDE which can be used to "look" into dynamically allocated variables in C.

If for example I use the code below, it is not possible to use the watches (CodeBlocks) to track the variables, only the adresse the pointer is pointing to is displayed.

int *ptr=NULL;

ptr=calloc(1, sizeof(int));
1

There are 1 answers

1
Grzegorz Szpetkowski On BEST ANSWER

Any decent IDE that comes with debugger should allow you to view dereferenced value of an pointer. I am not familiar with CodeBlocks, but for instance Eclipse CDT does such thing pretty easily:

enter image description here

By default it prints just *ptr, but you may set it to view as array of particular size.