I have two C codes. test.c is
#include <stdlib.h>
int main ()
{
int a;
a = 5;
return a;
}
test2.c is
#include <stdlib.h>
int main ()
{
int a;
a = 6;
return a;
}
When I run them and I check the address in memory of the "a"s with gdb I get the same address. Why is this so?
Breakpoint 1, main () at test.c:7 7 return a; (gdb) print &a $1 = (int *) 0x7fffffffe1cc
Breakpoint 1, main () at test2.c:7 7 return a; (gdb) print &a $1 = (int *) 0x7fffffffe1cc
5and6(no such thing), you're checking the address ofa.