Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site hadron.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!caip!seismo!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.lang.c Subject: Re: Passing Multidimensional Arrays Message-ID: <133@hadron.UUCP> Date: Thu, 19-Dec-85 02:06:08 EST Article-I.D.: hadron.133 Posted: Thu Dec 19 02:06:08 1985 Date-Received: Fri, 20-Dec-85 05:51:37 EST References: <138@brl-tgr.ARPA> <365@codas.UUCP> <34@dg_rtp.UUCP> <397@codas.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 31 Keywords: arrays, pointers, arguments, repeat, repeat Summary: Arrays are not Pointers are not Arrays are not ... (First off, the original code fragment, while syntactically legal C, was most definitely semantically incorrect.) In article <397@codas.UUCP> mikel@codas.UUCP (Mikel Manitius) writes: > ... Then explain, if you don't mind, how >the compiler knows the dimensions of argv in the following construct: >#include >main(argc, argv) >int argc; >char *argv[]; >{ > int i, j; > for(j=0;argv[j][0] != '\0';j++) { > for(i=0;argv[j][i] != '\0';i++) > putc(argv[j][i], stdout); > putc('\n', stdout); > } >} Easy. Argv is n o t a 2-D array. It is an array of pointers. If my yesterday's article on the subject hasn't arrived at your machine yet, wait a couple days and then m a i l to me to see whether I can retrieve a copy for you. If anyone kept a copy of my 100+ line diatribe on arrays and pointers, and why people confuse them so, from a year ago, wouldst please mail a copy to me? I'm afraid I didn't keep a copy, and if this line of discussion keeps up, I'm going to need it. ;-} -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}