X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: 04 Feb 2004 13:19:49 +0200 Message-Id: From: Eli Zaretskii To: djgpp AT delorie DOT com In-reply-to: <20040204035022.22737.00000765@mb-m19.aol.com> (sterten@aol.com) Subject: Re: array indices [i][j] References: <20040204035022 DOT 22737 DOT 00000765 AT mb-m19 DOT aol DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: sterten AT aol DOT com (Sterten) > Newsgroups: comp.os.msdos.djgpp > Date: 04 Feb 2004 08:50:22 GMT > > why should someone want to take a value - and then discard it ? It is useful when the computation has a side effect. For example: for (x = 1, y = 0, z = 100; x < 100; x++, y++) Here the expression "x = 1" yields a value of 1, but it also has a side effect of assigning 1 to x. > I mean, if this A[i,j,k] isn't really needed, then can't we > define it to be A[i][j][k] ? No, we can't, since the basic syntax of C cannot be changed without changing the language. > > #define MA(i,j,k) A[i][j][k] > > > >(note the use of parentheses instead of square brackets), or a similar > >definition of an inline function. > > very good ! Actually, not very good because using macros to change a syntactic appearance of a programming language is generally a bad habit. For starters, people who read your program will have difficulty understanding the code. And you yourself prevent yourself from learning C faster.