how do i do that? well i want to check if the array is empty
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually, when you have an array a[SIZE], you can always check:But it’s not necessary, unless you created a dynamic array (using operator new).
See the other answers, I won’t delete it just because it’s accepted now. If other answer is accepted, I’ll delete this “answer”.
EDIT (almost 4 years later 🙂 )
As I get many down-votes for this, I’d like to clarify: I know this is useless and
awill never be NULL, but it technically answers the question about theNULLpart.Yes, it does NOT mean, the array is empty, NOT at all. As @JamesMcNellis notes below, arrays cannot be NULL, only pointers.
It could only be useful for dynamically allocated arrays with initialized pointer before the allocation.
Anyway, I’ll wait for accepting other answer and will delete mine.