Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ttrdc.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: net.lang.c,net.lang.f77 Subject: Re: Address of array Message-ID: <807@ttrdc.UUCP> Date: Tue, 25-Mar-86 22:30:33 EST Article-I.D.: ttrdc.807 Posted: Tue Mar 25 22:30:33 1986 Date-Received: Fri, 28-Mar-86 06:11:28 EST References: <750@abic.UUCP> <2293@utcsri.UUCP> <313@hadron.UUCP> <150@sdchema.sdchem.UUCP> Organization: AT&T, Computer Systems Division, Skokie, IL Lines: 39 Xref: watmath net.lang.c:8280 net.lang.f77:504 In article <150@sdchema.sdchem.UUCP>, tps@sdchem.UUCP (Tom Stockfisch) writes: >[] >Joe Yao replies >>I don't really see what the problem is that people are moaning >>about. If you want a pointer to the array, the array name itself >>coerces to a pointer containing the memory location at the beginning >>of the array. There is no such thing as a pointer to the whole >>array: that is a Pasqualische or Fortranian notion. 'Scuse me, can somebody educate me as to why that would be a "Fortranian" (I withhold opinion on the Pascal allegation) notion? I was under the impression that most, if not all, Fortrans implement array references pretty much the same way that C does: by reference to the address of the first element in the array, with offsets computed according to the subscripts and then automatically dereferenced for use. The only differences I could see is in argument passing where C can pass things by value, whereas Fortran must pass by reference. FORTRAN C INTEGER I(1000) <--> int i[1000]; J = I(50) <--> int j = i[49]; I(3) = 8 <--> i[2] = 8; CALL FOO(I) <--> foo(i); /* pass address of first element */ CALL FOO(I(3)) <--> foo(&i[2]); /* or of another? */ ... ... SUBROUTINE FOO(K) <> foo(k) /* and dereference on the "other side" */ INTEGER K(1000) int k[1000]; { WRITE(*,*)K(3) printf("%d\n",k[2]); ... ... END } -- ------------------------------- Disclaimer: The views contained herein are | dan levy | yvel nad | my own and are not at all those of my em- | an engihacker @ | ployer or the administrator of any computer | at&t computer systems division | upon which I may hack. | skokie, illinois | -------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, vax135}!ttrdc!levy