🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2201

Re: "extern" and function declarations

#2201
From: Arun M. Thomas
Date: Thu, 07 Mar 1996 14:42
32 lines
2085 bytes
In article <4hlael$4ed@solutions.solon.com> fred@genesis.demon.co.uk (Lawrence Kirby) writes:
--SNIP--
>   Declarations and definitions are applicable to both objects (variables)
>   and functions. In both cases you can declare an identifier which is simply
>   a name you can use in the source code to 'access' the object or function.
>   You can also have a definition for either which is what allocates the
>   memory for the object or function. For a function the definition is where
>   you supply the function body within {} . Tentative definitions are not
>   applicable to functions - you either supply a body or you don't, there is
>   no default function body supplied by the compiler, which is also why
>   extern becomes redundant in function declarations/definitions.
--SNIP--

With respect to the first line in this paragraph then, how does one declare 
a variable without also defining it?  A statement like:

	int i;

both declares and creates a tentative definition of the variable if I am
understanding correctly.  (I can't think of a case in which it will actually be
necessary to declare without defining a variable, but I'm asking to find out if
it is possible.  If there is a situation in which it would be useful to declare
without defining, I would appreciate an example.)

>From the discussion preceding the section included above, I gathered that 
within a function, a statement like the above (i.e. "int i;") is in fact a 
bare declaration, with no default value assigned to it.  If this understanding
is incorrect, please let me know :)

Danke,
-Arun Thomas
Technical Details
Message-ID: <4hmslc$b35@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4hlael$4ed@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: thomas@eel.rdc.toshiba.co.jp (Arun M. Thomas)
Newsgroups: comp.lang.c.moderated
Subject: Re: "extern" and function declarations
Date: 7 Mar 1996 08:42:52 -0600
Organization: Toshiba Corporation, RDC Center, Kawasaki, JAPAN
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4hmslc$b35@solutions.solon.com>
References: <4hlael$4ed@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com