Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
0-based indexing?
Message
From
03/08/2002 20:24:56
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00685916
Message ID:
00685945
Views:
18
Chris,

In C, an array uses a pointer to a particular place in memory. Each array member is at an offset to the first memory location of the array. For example, if you have an array called myArray:
memory_location = myArray + array_index * sizeof_each_array_member
It has been a while since I worked with C. I don't recall if that is officially the reason, but the pointer math is convenient when using zero based loops, etc...

>I am not sure if 0-based indexing is the correct term, but I am wondering why in .NET the first element of an array starts is indexed with 0. I know this is done in 'C', but I can't remember the rational for it.
Steve Gibson
Previous
Reply
Map
View

Click here to load this message in the networking platform