Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!hao!boulder!peaks!bdw From: bdw@peaks.UUCP Newsgroups: comp.lang.c Subject: Re: static variables Message-ID: <196@peaks.UUCP> Date: Wed, 3-Jun-87 16:33:51 EDT Article-I.D.: peaks.196 Posted: Wed Jun 3 16:33:51 1987 Date-Received: Sat, 6-Jun-87 04:30:49 EDT References: <7653@brl-adm.ARPA> Organization: Software Craftworks, Boulder, Co, Usa Lines: 31 Summary: strings in functions not static unless declared so In article <7653@brl-adm.ARPA>, jfjr@mitre-bedford.arpa writes: > > Are character strings local to a function static?? > > given this > > int do_something() > { > char * some_string = "some string" > do_things; > return(some_int); > } > > is some_string static?? > > Jerry Freedman,Jr No. "some_string" is a char pointer which is initialized to point to "some string" every time "do_somthing" is called. It (the pointer) is in the stack. If it needs to be static the declaration would be: static char *some_string="some string"; Where "some string" actually is is up to the compiler writer. The two places I can think of off-hand are: - in the code - in some hidden global data area Would some one who's written a C compiler comment on this? Bruce Welker ...!hao!boulder!peaks!bdw