Pointer question

Chris Torek chris at mimsy.umd.edu
Thu May 3 07:08:48 AEST 1990


In article <19515.263eadf8 at oregon.uoregon.edu> slewis at 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 at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list