The Basic language... ah yes i had a stint with that for about 3 weeks. and
in those 3 weeks i sort of learned alot and the problem is with basic is
that it is so easy that you dont forget.

"James Curran" <jamescurran@mvps.org> wrote:
> However, we should note that what you said *is* correct for the Basic
>language ("Dim A(10)" creates an 11-element array, numbered 0 - 10)
>
> And to further complicate matters, the corresponding syntax in Fortran,
>if I recall correctly, creates a 10-element array, number 1-10.
>
>--
>Truth,
>James Curran
>http://www.NJTheater.com
>http://www.NJTheater.com/JamesCurran
>
>
>
>"Dan" <daniel_143@hotmail.com> wrote in message
>news:38ce9442$1@news.devx.com...
>>
>> Yo buddy calm down. Allright your right im wrong, no need to go nuts.

I
>> just created a quick console application with MSVC++ thats why 'stdafx.h'
>> got included and i chosed not to remove it.
>>
>> Danny Kalev <dannykk@inter.net.il> wrote:
>> >
>> >
>> >Dan wrote:
>> >
>> >> P.S - Even the best of us make mistakes ... :-)
>> >> forget about it
>> >
>> >Exactly. And your code below is an instance of such a mistake. The
>> >element arInt[9] is *out of the array bounds*. On many OS's your
>> >program would crash at runtime because it writes to an illegal memory
>> >address. Your array has 9 (nine) elements, not 10, not 11, not even 8.
>> >Now let's count together:
>> >0,1,2,3,4,5,6,7,8. How many numbers can you see here? NINE, exactly.
>> >Therefore, arInt[9] would be the tenth element of such an array. This

is
>> >one element past the array's bounds and as such, it's illegal to write
>> >to this "element". To prove my claim, try the following:
>> >
>> > char arInt[9];
>> > char secondarr[2] = {'a', 'a'};
>> > arInt[9] = 'b';
>> > cout<< secondarr[0]; // surprise! instead of 'a' you'll see 'b'.
>> >
>> >The fact that your program doesn't crash is ascribed to sheer luck. You
>> >should learn some more about arrays, because your claims are totally
>> >unfounded.
>> >
>> >BTW, there's no need to include "stdafx.h" in your program. Any further
>> >questions?
>> >
>> >
>> >Danny Kalev
>> >
>> >"The ANSI/ISO C++ Professional Programmer's Handbook"
>> >http://www.amazon.com/exec/obidos/ASIN/0789720221
>> >
>> >Please reply to the newsgroup.
>> >
>> >
>> >>
>> >> I really dont like saying 'i told you so' so just you try this code,

>and
>> then
>> >> you tell me ar[10] creates a 10 (0-9)element array rather than a

>11(0-10)
>> >> element array.
>> >>
>> >> #include "stdafx.h"
>> >> #include <iostream.h>
>> >>
>> >> int main(int argc, char* argv[])
>> >> {
>> >>
>> >> char arInt[9];
>> >>
>> >> arInt[0] = 'b';
>> >> arInt[9] = 'a';
>> >>
>> >> cout << arInt[0];
>> >> cout << arInt[9];
>> >>
>> >> return 0;
>> >> }
>> >>
>> >>
>> >> Danny Kalev <dannykk@inter.net.il> wrote:
>> >> >
>> >> >
>> >> >Dan wrote:
>> >> >>
>> >> >> You have really made a simple mistake. From looking at that snippet

>> of
>> >> code
>> >> >> you are trying to declare an array of student objects... but...

you
>> made
>> >> >> a small mistake, your array does not have a size. I know there is

a
>> better
>> >> >> way to say that but im at a loss for words now. Since your array

>has
>> >> no
>> >> >> size, the compiler reports an 'unknown size' error. Here is a fix:
>> >> >>
>> >> >> Student* arrayStudents[10];
>> >> >>
>> >> >> This creates an array of Student objects with 11 elements, remeber

>> c++
>> >> starts
>> >> >> from zero.
>> >> >
>> >> >Actually, it creates a 10-element array. The array ranges are between

>> 0
>> >> >- 9.
>> >> >
>> >> >Danny Kalev
>> >> >
>> >> >http://www.amazon.com/exec/obidos/ASIN/0789720221
>> >> >Please reply to the newsgroup.

>>

>
>