What is the difference between malloc and calloc?

Asked 1 years ago, Updated 1 years ago, 99 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.