C++: Is there a Value used to designate the end-of-an-array for non-char arrays?

John Love-Jensen eljay@adobe.com
Mon Jan 23 12:11:00 GMT 2006


Hi Robert,

> I am curious if there is any sort of value used to designate the end of
> an array for arrays that are not of type char.

Nothing in particular is used by convention.

You can create your own convention, if you so choose and it works for the
numbers you are working with.  For example, if I had an array of floats that
were between -1.0f and +1.0f, I could choose some arbitrary number, say
2.0f, to represent end-of-array.

Alternatively, I could associate an array length size_t and not have an
explicit end-of-array value.

HTH,
--Eljay



More information about the Gcc-help mailing list