Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site obo586.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!bellcore!decvax!mcnc!philabs!cmcl2!seismo!hao!nbires!gangue!obo586!dir From: dir@obo586.UUCP (Dan Rosenblatt) Newsgroups: net.lang.c Subject: sizeof() didn't produce expected value, but it wasn't wrong Message-ID: <126@obo586.UUCP> Date: Fri, 3-May-85 00:38:27 EDT Article-I.D.: obo586.126 Posted: Fri May 3 00:38:27 1985 Date-Received: Mon, 6-May-85 01:38:39 EDT Organization: obo Systems Inc., Aurora, Colorado Lines: 28 [] A function I wrote for some graphics software looked something like: vecmul(invec,inmat,outvec) double invec[3],inmat[3][3],outvec[3]; { int i,j; double tmpvec[3]; for (i=0;i<3;++i) { tmpvec[i] = 0.; for (j=0;j<3;++j) tmpvec[i] += invec[j] * inmat[i][j]; } bcopy((char *)outvec,(char *)tmpvec,sizeof(outvec)); } The calling sequence for bcopy was: (dst,src,size_in_bytes). The problem is that 'sizeof(outvec)' produced the value 2 instead of what I expected - 24. The reason is (as I kick myself around the room :-}) is that an array which is a parameter to a function becomes a pointer to that array. The 2 comes from the fact that I'm running on a 16-bit 8086 chip. 'nuf said. Dan Rosenblatt obo Systems, Inc. ...{ihnp4!denelcor,nbires!gangue}!obo586!dir