Consider this code snippet:


I'm trying to find the code that declares the global variable in Ollydbg.

I can't find where it is.

  • 1
    Please note that you can paste code directly in any StackExchange site, instead of a screenshot from your editor. To add code markup, put 4 spaces at the beginning of each line. – glampert Dec 16 '14 at 14:41

The C compiler doesn't create any assembly code to declare and initialize global fundamental data types, so you won't see anything like MOV ..., 3 in OllyDbg for your program above.

In the disassembly of your program below, you can see that the global variable is stored at dword_402000, which is hardcoded to begin with a value of 3:


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.