banner
Mar 26, 2022
92 Views

Khác nhau giữa malloc() và calloc()

Written by
banner

malloc() chỉ có 1 argument, là số byte mà nó allocate trong mem.

calloc() có 2 arguments: 
1) Số block nó allocate. 
2) Kích cỡ mỗi block tính theo byte.

malloc không ghi trước nội dung các bytes nó allocate, calloc sẽ set tất cả các byte mà nó allocate thành 0.

Article Tags:
· · ·
Article Categories:
dev
banner

Leave a Reply

Your email address will not be published. Required fields are marked *