argc[argv]

jhh at ihldt.UUCP jhh at ihldt.UUCP
Wed Dec 21 01:58:50 AEST 1983


	From:  Ken Laws <Laws at SRI-AI.ARPA>

	Beginners may have trouble with the statement that a[b] is entirely
	equivalent to *(a+b).  This is only true for character arrays.  For
	other types of arrays the translation is *(a+b*sizeof(*a)).

						-- Ken Laws
-------
a[b] IS equivalent to *(a+b) for all types of arrays.  The addition
is 'special' in that the result of a+b is a+b*sizeof(*a) for all
a that are type pointer to something and b int.
Beginners probably have trouble with the statement that
a+b != (int)a + b
for all types of a except char * and other non-pointers.
		John Haller



More information about the Comp.unix mailing list