As reference, I\'m using the following code:
#include
#include
int main (void) {
char buf[100]; // ------> How do I find
The &
operator will work when gdb is set to C language mode (and Objective-C).
In any language mode you can use
(gdb) info address buf
Symbol "buf" is static storage at address 0x903278.
(The output does not correspond exactly to your code.) I am writing this answer because this question is found even by people looking for the answer for other languages (including myself). One can also always switch to the C mode by set language c
, but the symbol names may be different after this change.