ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
What's the difference between calloc() and malloc()?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What's the difference between calloc() and malloc()?
Answer
# 1
calloc() takes two arguments, and initializes the allocated
memory to all-bits-0.
 
Is This Answer Correct ?    4 Yes 0 No
Guest
 
  Re: What's the difference between calloc() and malloc()?
Answer
# 2
Malloc allocates a block of memory whereas using calloc we 
can allocate array of memory blocks and all locations are 
initialized to zeros
 
Is This Answer Correct ?    4 Yes 1 No
K.thejonath
 
 
 
  Re: What's the difference between calloc() and malloc()?
Answer
# 3
the diffence is
1.prototype or no of arguments 
calloc takes two arguments
where as malloc takes 1 argument
void *calloc(int ,int);
first argument is no of blocks required
secund argument is no of elementts in each block required
void *malloc(int);
in this total no of bytes reuired are taken as the argument
2.
calloc clears the bytes which are allocated or reserved
where malloc can not guarentee this


sorry for my poor english
 
Is This Answer Correct ?    0 Yes 0 No
Valli
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
main() { printf(5+"Vidyarthi Computers"); }  6
How to write a code for random pick from 1-1000 numbers? The output should contain the 10 numbers from the range 1-1000 which should pick randomly, ie ,for each time we run the code we should get different outputs. NetApp12
Write code for initializing one dimentional and two dimentional array in a C Program? Deshaw5
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice) Subex1
explain about storage of union elements. Bosch2
What is the output of the following program #include<stdio.h> main() { int i=0; fork(); printf("%d",i++); fork(); printf("%d",i++); fork(); wait(); } ADITI5
how to find a 5th bit is set in c program IBM3
1 232 34543 4567654 can anyone tell me how to slove this c question  3
what is the advantage of function pointer TCS10
What is structure padding & expalain wid example what is bit wise structure?  1
What is the difference between constant pointer and pointer to a constant. Give examples. TCS4
what is the difference between declaration ,defenetion and initialization of a variable? LG-Soft5
wats SIZE_T meant for?  1
Print all the palindrome numbers.If a number is not palindrome make it one by attaching the reverse to it. eg:123 output:123321 (or) 12321  2
main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } what is the output? Ramco4
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen) NetApp1
how to implement stack work as a queue?  2
class foo { public: static int func(const char*& p) const; }; This is illegal, why? Google6
write a “Hello World” program in “c” without using a semicolon?  3
who did come first hen or agg Infosys12
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com