What is the difference between malloc and calloc?

Asked 2 years ago, Updated 2 years ago, 111 views

The method of using both is similar, and the size of the return is the same, but why is there a separate one? I can't tell the difference between the two.

c malloc calloc

2022-09-22 08:22

1 Answers

calloc() initializes the buffer to 0 malloc() does not initialize memory.

It takes some time to initialize all the memory to zero We usually use malloc() a lot without any special reason.


2022-09-22 08:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.