Mail Archives: djgpp/2000/04/29/10:38:41
>J-P wrote:
>
>> If char arrayname[80] is an array of 80 char,
>> . arrayname is (equivalent to) a pointer to the first char
>> . &arrayname is a pointer to a pointer to the first char
>
>No.
Ah. This is the relevant bit from K&R. Appendix A7.3 - Postfix
Expressions (subsequently "PE"s).
A7.3.1 Array References
A PE followed by an E in square brackets { i.e. PE[E] - jps } is a
postfix expression denoting a subscripted array reference. One of
the two expressions must have type "pointer to T", where T is some
type, and the other must have integral type.
So in my example, "arrayname" /is/ of type "pointer to char". Isn't it?
According to K&R, at least, there seems no ambiguity.
Perhaps the printf family of functions is clever and recognises pointer to
pointer, and the standard libraries allow gcc to compile equivalent
executables. Any idea? Have I interpreted K&R wrong, do K&R slip up at
this point, or is gcc/printf doing something wiley?
If anyone wants to suggest a more relevant newsgroup, I'd happily follow
this there, trn willing.
J-P
--
Sacred Message // adopted by Japanese family // living next to NASA //
obscene orange flower // chance meeting with Ted Bundy
- Raw text -