Reputation: 31
I am writing a 32-bit MASM program to do numerous arithmetic. I want to initialize variables in my program such as num , val , etc.. in the declaration only once and only the first time. How do I do numerous arithmetic operations without re-initializing the variables?
ex:
num = 122 ; Initialize in declaration
val = 9 ; Initialize in declaration
res = val + num
cout << "res = " << res;
----------------------------- How do I continue to compute without re-initializing num and val???
num = 42
val = 100
val = val - num
cout << "val = " << val;
so do this only once in program:
num dword 122
val dword 9
Thanks in advance.
Upvotes: 0
Views: 2163
Reputation: 31
I figured it out. It was as simple as:
num dword 122 ; Initialize num
val dword 9 ; Initialize val
mov num, 42 ; NOW num = 42
mov val, 100 ; NOW val = 100
Thanks for the comments and response!
Upvotes: 1