home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!yale.edu!spool.mu.edu!sol.ctr.columbia.edu!destroyer!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
- From: dave@cs.arizona.edu (Dave Schaumann)
- Newsgroups: comp.lang.c
- Subject: Re: problem with "external pointer"
- Message-ID: <1992Sep7.175740.7864@organpipe.uug.arizona.edu>
- Date: 7 Sep 92 17:57:40 GMT
- References: <xu.715880256@prim.rose.utoronto.ca>
- Sender: news@organpipe.uug.arizona.edu
- Reply-To: dave@cs.arizona.edu (Dave Schaumann)
- Organization: University of Arizona
- Lines: 18
- In-Reply-To: xu@prim.rose.utoronto.ca (Jiefeng Xu)
-
- In article <xu.715880256@prim.rose.utoronto.ca>, xu@prim (Jiefeng Xu) writes:
- >Hi,netters! I have a problem which for you experts may be quite easy. Can I
- >define a pointer and use it as an external variable?
-
- Sure. I do this all the time.
-
- >If I use the following
- >
- >extern int *ps;
- >
- >my compiler (gcc) will ignore it and consider the ps as undefined.
-
- What you have to understand is that "extern int *ps;" is a /definition/ of
- "ps". You still need to have a declaration of "ps" somewhere in your source
- code. If you don't, the linker will complain (and rightly so).
-
- --
- --- jumbo shrimp --- pretty ugly --- awfully nice --- constant change ---
-