My very simple tested program
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a = 12345;
printf("%d\n", a);
system("PAUSE");
return 0;
}
After compiled and connected,the EXE file is created.Then I open the EXE file in the Ollydbg:
The picture shows the main() function.But I can't find out what the address of the variable a
is. When passing the params to the printf()
function,it push 3039
into the stack, then it means the value of the variable a
is 3039
? No,the value is 12345
. So it means the address of the variable a
is 00003039
? Anyone
Address of the a
variable is [ebp-8]
. You are seeing 0x3039
assignment, because decimal 12345
is hexadecimal 0x3039
. If you change your code to use hex value: int a = 0x12345
, results would be more clear:
Numeric constants are usually compiled directly into the code.