Ed Casas (edc@ece.ubc.ca) Mon, 11 Dec 2000 09:00:32 -0800
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- New Message to:eece379@listhost.ece.ubc.ca
- Reply to:Re: variables?
- Previous message: King Yung Hor: "variables?"
Date: Mon, 11 Dec 2000 09:00:32 -0800 From: Ed Casas <edc@ece.ubc.ca> Subject: Re: variables?> Is this the correct way of initializing a variable and then > giving it a value? If I am wrong please correct me (I want to > do this: int count = 4) > mov ax, 4 > mov count, ax > .... > > count db 1 dup (?) This is the correct way of declaring a variable and initializing it at run-time (e.g. if the variable has what C calls "automatic" storage class). For example: void foo(void) { int count = 4 ; } Then "count" gets initialized each time foo is called. On the other hand, if you wanted the variable to be initialized only once ("static" storage), then in C you would write: static int count = 4 ; and in assembly you would write: count db 4 -- Ed Casas edc@ece.ubc.ca http://casas.ece.ubc.ca +1 604 822-2592
- Previous message: King Yung Hor: "variables?"