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?


In general, no.

For some specific instances, there is a value but that value is put there by the C code (or C++ code) and not the "language" or the compiler. For example, the main program is called as: int main(int argc, char *argv[]) The argv array is an array of pointers to strings. The last entry in the array is a null pointer. But, as I said, that is set up by other code before main is called.

So, if you are writing just the receiving part of such an interface, check with the side that is creating the array to see if they are doing something similar. Or if you are creating both sides of the interface, then you can design and implement whatever you desire. Often, with an array of structures, a particular field in the structure is given a special value that should never otherwise occur.

HTH,
Perry


On Jan 23, 2006, at 2:08 AM, Robert Miesen wrote:


Hi.

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. I checked the book, "The C Programming Language", the book, "C++: The Complete Reference, 4th ed.", and briefly checked and found no information on the value used to designate the end of a non-character array.

Does such an end-of-array value exist for arrays that are not character arrays? Thank you for your responses in advance



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