www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/08/08:12:53

From: kagel AT quasar DOT bloomberg DOT com
Date: Fri, 8 Nov 1996 07:48:54 -0500
Message-Id: <9611081248.AA05088@quasar.bloomberg.com >
To: cs19 AT cityscape DOT co DOT uk
Cc: djgpp AT delorie DOT com
In-Reply-To: <847448023.11346.0@ciscs19.demon.co.uk>
Subject: Re: Help with Definition: int p=0,d[4]
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   From: cs19 AT cityscape DOT co DOT uk (BDC Client Team)
   Date: Fri, 08 Nov 1996 10:13:43 GMT

   I am very new to c++ and am attempting to learn it in the usual way - download
   other peoples programs, examine the code, work out what it does, chang it to see 
   what happens, etc.

   I recently downloaded a program that had a definition at the start of a
   subroutine.  The definition is:

   int p=0,d[4]

   It is obviously defining an integer variable 'p' and assigning a start value
   to it - can anyone help me with the right-hand side of the '=' sign ?  
   There is no reference to a variable 'd' in the rest of the code, so I assume 
   that, in this case, 'd'is recognized by the compiler as a function/constant 
   of some kind.

Nah just some sloppy code.  The variable d is just an array of 4 int's which is
no longer used and was never removed.  (Unless the author overrode the comma
operator (,) in which case you'd have to look at the code and headers to figure
that out; and I'm not sure one can do that anyway!)  BTW I assume you dropped
the trailing semi-colon on the declaration?!?

-- 
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com

A proverb is no proverb to you 'till life has illustrated it.  -- John Keats

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019