Search code examples
cnm

Finding the address of a main function local variable


Let's say we have the following C code:

#include<stdio.h>
int main(){
  char *a = "askakasd";
  return 0;
}

I tried to find my local variable "a", but I don't know how to recognize it looking in this output, where p is the C code compiled:

enter image description here


Solution

  • It's not there. Since the code can't tell at execution time whether it's there or not, the linker removed it to save space.