home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu
- From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
- Newsgroups: comp.lang.c
- Subject: Re: Address of static variables??
- Keywords: static variables
- Message-ID: <1992Sep11.132917.2038@klaava.Helsinki.FI>
- Date: 11 Sep 92 13:29:17 GMT
- References: <1992Sep11.115912.9604@hippo.ru.ac.za>
- Organization: University of Helsinki
- Lines: 15
-
- ifkm@hippo.ru.ac.za (Andrew Murdoch) writes:
- >Is the static variable some_string always guaranteed to have
- >the same address?
-
- During one execution of the program, yes.
-
- >That is, will a_pointer always be a valid
- >pointer? Of course some_function would have to be called first.
-
- As long as it points into the static variable in question, yes. It can
- naturally become invalid if you change it, but that depends on how you
- change it ("a_pointer = (char*)1;" will most probably make it invalid).
-
- --
- Lars.Wirzenius@helsinki.fi
-