This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]