Re: how to find out the address of a variable after I compile the C file
- From: "Stephen Sprunk" <stephen@xxxxxxxxxx>
- Date: Thu, 18 May 2006 08:35:25 -0500
"pete" <pfiland@xxxxxxxxxxxxxx> wrote in message news:446BC3FE.3BB4@xxxxxxxxxxxxxxxxx
bijayadipti@xxxxxxxxx wrote:I have a C program. I have compiled it uisng gcc and also avr-gcc. Now
after compiling, I want to know the addresses of the two variables in
my program. Is there any options that I can use to find that out? Is
there any way at all to find that out? Someone told that it was
possible but I am not able to find out.
If a variable is local to a function other than main,
then it may or may not have the same address,
each time the function is called during the run of the program.
On some (many?) architectures, even globals, statics, and main()'s locals will vary across runs. In the case of recursive functions, different instances of the same locals may exist in several places.
The only decent answers are "find out with the & operator at runtime" or "use a debugger".
S
--
Stephen Sprunk "Stupid people surround themselves with smart
CCIE #3723 people. Smart people surround themselves with
K5SSS smart people who disagree with them." --Aaron Sorkin
*** Posted via a free Usenet account from http://www.teranews.com ***
.
- References:
- Prev by Date: Re: -1>>4 and -1<<4
- Next by Date: If you were given a mall would you take?
- Previous by thread: Re: how to find out the address of a variable after I compile the C file
- Next by thread: Re: how to find out the address of a variable after I compile the C file
- Index(es):
Relevant Pages
|