I have an array of structs that I created somewhere in my program.
Later, I want to iterate through that, but I don’t have the size of the array.
How can I iterate through the elements? Or do I need to store the size somewhere?
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.
You can store the size somewhere, or you can have a struct with a special value set that you use as a sentinel, the same way that
\0indicates the end of a string.