Thats not what i meant. Say i get a string with gets(i know its unsafe
blablabla fgets bla) and i run over the array is there a bounds checking
formula? My question is answered already. Thanks to all who responded.
Richard Ivanowich
----------
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: Re: Arrays
> Date: Sunday, January 10, 1999 1:32 AM
>
> On Sat, Jan 09, 1999 at 10:41:21AM -0600, Richard Ivanowich wrote:
> > Hello all,
> >
> > Now i know arrays do no bound checking. How would i make it do bound
> > checking?
> >
>
> Why would you need bound checking? You know the size of the array
> because you declared it, just write the loop accordingly.
>
> BTW, your loop is wrong
>
> > ie. int array[10];
> >
> > for(i=0;i<=11;i++) {
> > array[i]=i;
> > }
> >
>
> It should be
>
> for (i = 0; i < 10; i++) {
> array[i] = i;
> }
>
> Your index range is from 0 to 9.