Iterate through a C array

后端 未结 4 1348
南笙
南笙 2020-12-02 22:41

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

4条回答
  •  悲&欢浪女
    2020-12-02 23:12

    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 '\0' indicates the end of a string.

提交回复
热议问题