Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


difference between malloc and calloc

Answers were Sorted based on User's Feedback



difference between malloc and calloc..

Answer / namita

1-memory allocated by malloc contains garbage value.But
memory allocated by calloc is initialised to zero.

2-malloc takes only one argument which indicates the size
to be allocated.But calloc takes two arguments.First
argument indicates the number of blocks to be allocated
where as the second argument indicates the size of the
block.

Is This Answer Correct ?    35 Yes 2 No

difference between malloc and calloc..

Answer / vara

There are two differences.
1) is the number of arguments. Malloc() takes a single
argument (memory required in bytes), while calloc() needs
two arguments (number of variables to allocate memory, size
in bytes of a single variable).
2)malloc() does not initialize the memory allocated, while
calloc() initializes the allocated memory to ZERO.

Is This Answer Correct ?    15 Yes 2 No

difference between malloc and calloc..

Answer / bijaya

1)malloc() function does not initialize the memory which it
allocates thats why it takes the garbage value.but calloc()
function initializes the allocated memory to zero thats why
it cant take any garbage value.

2)malloc() function takes single arg.that is the variabe
which is used to indicate the memory size to be
allocated.calloc() function takes two args-i) variable which
indicates the number of memory blocks.ii)variable which
indicates the size of each blocks.

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More C Interview Questions

True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type

7 Answers  


What is use of null pointer in c?

0 Answers  


What is the difference between class and object in c?

0 Answers  


Write a program that takes a 5 digit number and calculates 2 power that number and prints it

7 Answers  


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

0 Answers  


Explain low-order bytes.

0 Answers  


Write a program in C for showing working of different logical operator in C. Your program should guide users with proper message/menu on the console.

3 Answers   HCL,


what do structure language means?

3 Answers   Microsoft,


swap two integer variables without using a third temporary variable?

6 Answers   Persistent,


main() { int i=400,j=300; printf("%d..%d"); }

13 Answers   ME,


What is the purpose of sprintf?

0 Answers  


is assignment operator is arithmatic or not

3 Answers   Infosys,


Categories