This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C++: Is there a Value used to designate the end-of-an-array for non-char arrays?
- From: Perry Smith <pedz at easesoftware dot net>
- To: Robert Miesen <bobby_miesen at yahoo dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 23 Jan 2006 08:08:49 -0600
- Subject: Re: C++: Is there a Value used to designate the end-of-an-array for non-char arrays?
- References: <43D48F0D.60306@yahoo.com>
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