C : malloc seems to allocate more then i'm requesting (array)

前端 未结 4 1916
青春惊慌失措
青春惊慌失措 2021-01-15 22:48

Hi I have this question: Why when I\'m allocating memory with malloc for a float array, it allocate more space that i\'m requesting? For example in this code i\'m trying to

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-15 23:00

    It's not unlikely that, depending on allocation algorithm, that more is allocated than you request. However, accessing that memory is undefined behavior.

提交回复
热议问题