Find the exact address of variable Buf

后端 未结 3 373
甜味超标
甜味超标 2021-02-03 22:48

As reference, I\'m using the following code:

#include 
#include 

int main (void) {
    char buf[100]; // ------> How do I find         


        
3条回答
  •  粉色の甜心
    2021-02-03 23:31

    (gdb) p &a if you need the address of variable a. A variable might be cached in a register though, in which case GDB would tell you address requested for identifier "a" which is in register $xxx.

    Sidenote: do not use gets, see here.

提交回复
热议问题