Path: utzoo!attcan!uunet!lll-winken!ames!oliveb!apple!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Clarification needed on Pointers/Arrays Message-ID: <9721@smoke.BRL.MIL> Date: 26 Feb 89 02:43:21 GMT References: <1436@etive.ed.ac.uk> <889@acf3.NYU.EDU> <11840@haddock.ima.isc.com> <3636@xyzzy.UUCP> <23877@watmath.waterloo.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 17 In article <23877@watmath.waterloo.edu> rbutterworth@watmath.waterloo.edu (Ray Butterworth) writes: -int A[10]; -float F; -short S; -What is A when evaluated in an expression? a constant pointer to an int. -What is F when evaluated in an expression? a double. -What is S when evaluated in an expression? an int. It all depends on the context. For example, consider sizeof(whatever). That's why it is best not to mentally map the type until the language rules require that it be mapped. One of our computer vendors once decided to map array names to pointer prematurely, so that sizeof A returned 4 no matter how big the array A was. We screamed and they eventually fixed that bug. Let that serve as a warning of the danger of trying to map types before their time.