in Technology by
What is the difference between malloc and calloc?

1 Answer

0 votes
by

A malloc and calloc are memory management functions. They are used to allocate memory dynamically. Basically, there is no actual difference between calloc and malloc except that the memory that is allocated by calloc is initialized with 0. In C language,calloc function initialize the all allocated space bits with zero but malloc does not initialize the allocated memory. These both function also has a difference regarding their number of arguments, malloc takes one argument but calloc takes two.

Related questions

0 votes
    Distinguish between malloc() & calloc() memory allocation?...
asked Jan 17, 2021 in Technology by JackTerrance
+1 vote
    Distinguish between malloc() & calloc() memory allocation....
asked Nov 9, 2020 in Technology by JackTerrance
0 votes
    Is it better to use malloc () or calloc ()?...
asked Jan 23, 2021 in Technology by JackTerrance
0 votes
    What is the return value of malloc (0)?...
asked Jan 23, 2021 in Technology by JackTerrance
0 votes
    What is the return value of malloc (0)?...
asked Jan 22, 2021 in Technology by JackTerrance
0 votes
    I am observing the following behavior in my test program: I am doing malloc() for 1 MB and then ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    What are the difference between Task and Thread in .NET?...
asked Feb 16, 2023 in Technology by JackTerrance
0 votes
    What's the difference between SDK and Runtime in .NET Core?...
asked Feb 16, 2023 in Technology by JackTerrance
0 votes
    What is the difference between .NET Core and Mono?...
asked Feb 16, 2023 in Technology by JackTerrance
0 votes
    The main difference between SNMPv3 and SNMPv2 is _______. A. Enhanced security B. Integration C. Management D. Integration...
asked Feb 14, 2023 in Technology by JackTerrance
0 votes
    What is the difference between an abstract class and an interface?...
asked Feb 9, 2023 in Technology by JackTerrance
0 votes
    What is the difference between a constructor and a method?...
asked Feb 9, 2023 in Technology by JackTerrance
0 votes
    What is the difference between method overloading and method overriding?...
asked Feb 9, 2023 in Technology by JackTerrance
0 votes
    What is the difference between Maven and ANT?...
asked Feb 5, 2023 in Technology by JackTerrance
...