How to locate the address of an element in array

less than 1 minute read

Eclipse and gdb does not show the address of the element in the array. You might want to know the address to make sure boundaries of the array are correct. You should use address-of operand to get the address. Easy huh?

On gdb,

p &array[element]

On eclipse, open expressions tab and add &array[element] to Name field.

Sometimes you miss the easiest things.

Categories: ,