c++ sizeof(array) return twice the array's declared length

前端 未结 6 1780
情书的邮戳
情书的邮戳 2020-12-02 02:47

I have a section of code in which two array are declared with sizes of 6 and 13, but when \'sizeof()\' is used the lengths are returned as 12 and 26.

#includ         


        
6条回答
  •  难免孤独
    2020-12-02 03:44

    sizeof is an operator in C++ that measure the size in number of bytes.I think in your machine integer take 2 bytes that's why It's displaying the double the size of the array.

提交回复
热议问题