Totalview® User Guide
:
Part II: Debugging Tools and Tasks
:
Examining and Editing Data and Program Elements
:
Changing a Variable’s Data Type
:
Type-Casting Examples
:
Displaying Allocated Arrays
Displaying Allocated Arrays
The C Language uses pointers for dynamically allocated arrays; for example:
int *p = malloc(sizeof(int) * 20);
Since TotalView doesn’t know that
p
actually points to an array of integers, you need to do several things to display the array:
1
Dive on the variable
p
of type
int*
.
2
Change its type to
int[20]*
.
3
Dive on the value of the pointer to display the array of 20 integers.