What is significance of calloc function in C?

Questions by Tapas Mallick

Showing Answers 1 - 9 of 9 Answers

Manish Rai

  • Nov 19th, 2014
 

1. it is used to allocate memory for an array.
2. it also sets allocated memory to 0 which malloc dont.

  Was this answer useful?  Yes

Manish Rai

  • Nov 19th, 2014
 

1. it is used to allocate memory for an array.
2. it also sets allocated memory to 0 which malloc dont.

Code
  1. int* a = (int*) calloc(10, sizeof(int));  // where a sets to 0

  2. int* a = (int*) malloc(10* sizeof(int));  // where a is uninitialized

  Was this answer useful?  Yes

Sumit

  • Mar 5th, 2015
 

Its mainly used to allocate memory in blocks

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions