is this array access portable?
der Mouse
mouse at thunder.mcrcim.mcgill.edu
Sat Jun 29 22:30:56 AEST 1991
In article <1991Jun25.135920.4120 at cs.odu.edu>, kremer at cs.odu.edu (Lloyd Kremer) writes:
> In article <1991Jun23.185351.5695 at thunder.mcrcim.mcgill.edu> mouse at thunder.mcrcim.mcgill.edu (der Mouse) writes:
>> sometype foo[40][50]; sometype *fp; int i;
>> fp = &foo[0][0]; for (i=2000;i>0;i--) *fp++ = something;
>> Is this portable?
> Arrays are guaranteed contiguous, therefore arrays of arrays (being
> arrays themselves) are guaranteed contiguous.
Yes, but that doesn't necessarily mean that a pointer can run through
the whole array as I outlined above.
(By the way, does the answer to my original question change any if
"sometime" is known to be "char"?)
der Mouse
old: mcgill-vision!mouse
new: mouse at larry.mcrcim.mcgill.edu
More information about the Comp.lang.c
mailing list