Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!qt.cs.utexas.edu!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!mouse From: mouse@thunder.mcrcim.mcgill.edu (der Mouse) Newsgroups: comp.lang.c Subject: Re: is this array access portable? Message-ID: <1991Jun29.123056.21366@thunder.mcrcim.mcgill.edu> Date: 29 Jun 91 12:30:56 GMT References: <1991Jun23.185351.5695@thunder.mcrcim.mcgill.edu> <1991Jun25.135920.4120@cs.odu.edu> Organization: McGill Research Centre for Intelligent Machines Lines: 20 In article <1991Jun25.135920.4120@cs.odu.edu>, kremer@cs.odu.edu (Lloyd Kremer) writes: > In article <1991Jun23.185351.5695@thunder.mcrcim.mcgill.edu> mouse@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@larry.mcrcim.mcgill.edu