Doctor C's Pointers
Inst.f.Techn.Informatik
inst182 at tuvie
Thu Aug 2 21:13:11 AEST 1990
root at wotk.UUCP (Superuser) writes:
>I was reading the August issue of The C Users Journal and came across
>this in Rex Jaeschke's article -
>( It also allows expressions such as )
>( )
>( "abcd"[i] and f()[j] )
> ^^^^^
>I thought this was taboo. What's the story on this?
Why should this be taboo?
Provided f is declared as
sometype * f (void)
it returns a pointer to sometype, and I can subscript that pointer like
any other pointer. After all, in C arrays are treated like pointers to their
first element in almost any context. (Hope, the wording is correct, I don't
want to go through that Arrays-are-not-pointers discussion again)
Peter J. Holzer
| _ | Peter J. Holzer | Think of it |
| |_|_) | Technische Universitaet Wien | as evolution |
| | | | hp at vmars.tuwien.ac.at | in action! |
| __/ | ...!uunet!mcsun!tuvie!vmars!hp | Tony Rand |
More information about the Comp.lang.c
mailing list