Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Pointer question Message-ID: <24121@mimsy.umd.edu> Date: 2 May 90 21:08:48 GMT References: <19515.263eadf8@oregon.uoregon.edu> Distribution: usa Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 13 In article <19515.263eadf8@oregon.uoregon.edu> slewis@oregon.uoregon.edu writes: >... are the following assertions true: >1. p[i][j] == *( *(p+i) + j) == j[p[i]] == j[i[p]] >2. a[b[i]] == *( a + *(b+i)) == b[i][a] == i[b][a] Yes, these assertions hold always (even for p declared as `int p[10][4]', not just `int **p'). (As it happens, the 4BSD PCC-based compiler also emits better code for j[i[p]] than for p[i][j], at least when p,i,j are all global.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris