Array length counting anomaly

后端 未结 4 743
挽巷
挽巷 2021-01-26 05:17

The count is returning unpredictable results. Sometimes they are right. Sometimes totally weird. Anyone can tell me what is wrong?

#include 
int l         


        
4条回答
  •  一整个雨季
    2021-01-26 05:35

    Unlike strings, normal arrays do not terminate with a null byte 0x00. The reason strings use this is because arrays have no concept of length; arrays are merely contiguous pieces of memory, it is up to you to keep track of the length of arrays.

提交回复
热议问题