chutsu said:
It depends what you mean by "empty". If you think "filled with zero
values" means "empty", check each value for 0 to determine whether
the array is empty. If you mean something else, what do you mean?
If you mean "how do you check that a variable has not been assigned
a value?", you don't. If a variable (or rather, an object) has not
been assigned a value, you're not allowed to look at it. All you
can do is assign to it. Therefore, you the programmer are supposed
to know whether an object has been assigned a value.
To make this easier for myself, I try to remember to initialise
*everything*, and consider the absence of such initialisation to be
a bug in my program. Not everyone agrees with me. In fact, there
are some very bright people in this very newsgroup who disagree
with me... but I have my reasons (historical, and painful).
--
Richard Heathfield <
http://www.cpax.org.uk>
Email: -http://www. +rjh@
Forged article? Seehttp://
www.cpax.org.uk/prg/usenet/comp.lang.c/msgauth.php
"Usenet is a strange place" - dmr 29 July 1999