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...

WHAT IS THE DIFFERENCE BETWEEN malloc() and calloc() in c
file management?

Answer Posted / smitha

Malloc:
1. Takes only 1 argument- the size of the memory block to
be allocated.
2. Allocates memory as a single contiguous block.
3. Will fail if a single contiguous memory block of
required size is not available.

Calloc:
1. Takes two arguments - the number of memory blocks needed
and the size of each memory block.
2. It may or may not allocate a single contiguous block,
thus will not fail if a single contiguous memory block
of required size is not available.
3. Initialises the memory blocks to 0.

Is This Answer Correct ?    17 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

1109


Is c still used?

999


What is the difference between test design and test case design?

2030


What is the difference between malloc() and calloc() function in c language?

1029


What is pass by reference in c?

1146


Is there a way to compare two structure variables?

1058


Tell me when would you use a pointer to a function?

1011


Calculate 1*2*3*____*n using recursive function??

1982


What is c programing language?

1043


What are global variables?

1117


How can I remove the leading spaces from a string?

1097


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

2245


What is meant by realloc()?

1085


typedef struct{ char *; nodeptr next; } * nodeptr ; What does nodeptr stand for?

1585


What is nested structure in c?

1012