🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: vmsnet.internals
Article #349

Re: C Language question

#349
From: George J. Carrette
Date: Fri, 09 Oct 1992 14:32
24 lines
1166 bytes
In article <718580974.504412.MILLER@TGV.COM>, MILLER@TGV.COM writes:
> Remember:  a[i] really means *(a+i) using the rules for pointer addition.
> a[i] is a macro construct.
> So a[i][j] really works out to *((char *)&*(a+i) + j), I think.

Hey, the guy who said to ask this on comp.lang.c is only 50%
correct. This is FAQ item!

But anyway, not true in all cases. In other words, if you see this in a program:

   a[i][j]

you don't really know if it means reference a vector of vectors or not.

It all depends on how a was declared. If char a[][], or char **a, that
is one thing.

But, it may also have been declared char a[5][10]. In which case
the resulting memory operations are more like what you would expect from
FORTRAN. Not two memory references but one.

The is one of the funky things about the C programming language.

-gjc
Technical Details
Message-ID: <3067@mitech.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!mitech!gjc
References: <718580974.504412.MILLER@TGV.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mitech!gjc
From: gjc@mitech.com (George J. Carrette)
Newsgroups: vmsnet.internals
Subject: Re:  C Language question
Message-ID: <3067@mitech.com>
Date: 9 Oct 92 14:32:00 GMT
References: <718580974.504412.MILLER@TGV.COM>
Organization: Mitech Corporation, Concord MA
Lines: 24