www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/15/06:44:41

From: jpg AT wave DOT co DOT nz (Jon)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help with Definition: int p=0,d[4]
Date: Thu, 14 Nov 1996 18:51:13 GMT
Organization: Wave Internet Services
Lines: 24
Message-ID: <jpg.23.328B6A1F@wave.co.nz>
References: <847448023 DOT 11346 DOT 0 AT ciscs19 DOT demon DOT co DOT uk>
NNTP-Posting-Host: wh6009.wave.co.nz
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <847448023 DOT 11346 DOT 0 AT ciscs19 DOT demon DOT co DOT uk> cs19 AT cityscape DOT co DOT uk (BDC Client Team) writes:

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

>int p=0,d[4]

> can anyone help me with the right-hand side of the '=' sign ?  

This is defining an array of 4 integers. The elements of the array can be 
accessed as d[0],d[1],d[2],d[3] (in general, array x[n] is x[0] to x[n-1]).

>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.

If you compile the code with -Wall the compiler should warn you that the array 
is unused, it is not part of the compiler or c++ internals.

I  suggest a quick look at a few C books to pick up the basics before leaping 
into C++ headlong.

Hope this helps
Jon.

- Raw text -


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