ma6nrr@bath63.UUCP (02/11/87)
#undef LINE_EATER A point I am not clear on: I know that for a single-dimension array e.g. int a[20]; then a means &a[0].Is this generally true for multidimensional arrays e.g. will int b[5][6]; write ( fd , (char *) b , 30 * sizeof( int ) ); write out only the whole of array b to file no. fd ? Thanks in advance,Neil. /* */ main() { } /*/ } { )( niam /* */ /***************************************************************/ /* Send all flames to: */ /***************************************************************/ /* N.Rashbrook UUCP:seismo!mcvax!ukc!bath63!ma6nrr */ /* Undergraduate JANET:ma6nrr@UK.AC.BATH.UX63 */ /* University of Bath ARPA:ma6nrr%ux63.bath.ac.uk@ucl-cs.arpa */ /***************************************************************/
chris@mimsy.UUCP (02/12/87)
In article <762@bath63.ux63.bath.ac.uk> ma6nrr@bath63.ux63.bath.ac.uk (Rashbrook) writes: >I know that for a single-dimension array e.g. >int a[20]; then a means &a[0].Is this generally >true for multidimensional arrays Is what generally true? Abstracting from a single example is a dangerous game; I cannot guess what you mean by `this'. In almost all contexts, an object of type `array <n> of <type>' is altered to read `pointer to <type>', the value of the pointer being the address of the first element of that array. For example, given char a[7][3]; /* array 7 of array 3 of char */ the compiler sees the following types: a /* pointer to array 3 of char */ or &a[0] /* pointer to array 3 of char */ a[0] /* pointer to char */ or &a[0][0] /* pointer to char */ All of these expressions have the same `value' but different types; the types could conceivably be encoded as bits in the value field (e.g., tagged architectures) or in some other way alter the actual values, but these all represent the same memory location. >e.g. will > int b[5][6]; > write ( fd , (char *) b , 30 * sizeof( int ) ); > >write out only the whole of array b to file no. fd ? Yes. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) UUCP: seismo!mimsy!chris ARPA/CSNet: chris@mimsy.umd.edu