Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!usc!snorkelwacker!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: Array bounds checking with C???? Message-ID: Date: 31 Aug 90 14:26:36 GMT References: <7611@ucdavis.ucdavis.edu> <26196@mimsy.umd.edu> <988@christopher-robin.cs.bham.ac.uk> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 21 In-reply-to: cjr@cs.bham.ac.uk's message of 30 Aug 90 10:21:50 GMT In article <988@christopher-robin.cs.bham.ac.uk> cjr@cs.bham.ac.uk (Chris Ridd ) writes: | Why is this? I never could figure out why accessing the first | element *past* the end of an array should be legal. So that you can do something like: char array[ARRAY_SIZE]; void clear_array(){ char *p; for (p = &array[0]; p < &array[ARRAY_SIZE]; p++) *p = '\0'; } -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 Do apple growers tell their kids money doesn't grow on bushes?