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?

Answers were Sorted based on User's Feedback



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

Answer / monalisa dhal samanta

malloc() is a allocated 1 unit data type.it is a one argument
function .malloc allocate bytes of memory .
calloc() is a allocated sizeof data type .it is a two
argument .

Is This Answer Correct ?    8 Yes 3 No

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

Answer / priya

malloc() allocates bytes of memory for a single block
whereas calloc() allocates blocks of memory for multiple
blocks

Is This Answer Correct ?    8 Yes 3 No

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

Answer / vijay r15

malloc creates the
single block of gn
size by user. Malloc
takes 1ly 1 arg.

Calloc creates
multiple block of gn
size. It will
initialize the
reserved memory block
to zero. Calloc takes
2 arguments

Is This Answer Correct ?    7 Yes 2 No

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

Answer / dilip k. singh(dks)

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.
sUMMARY:
malloc() allocates 1 unit(datatype) of memory each time it
is called so to allocate memory for a file read char by
char allocating memory each time for a char till EOF.
calloc allocates sizeof(datatype) bytes to the no of
elements in the file, where by the user can specify the
file size as the second arguement.
char *malloc(sizeof(datatype) )
char *calloc(sizeof(datatype), num of elements)
calloc() is more efficient as memory is allocated in 1
cycle so fewer clock cycles, more faster executiop.

Is This Answer Correct ?    3 Yes 0 No

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

Answer / venkateswarlupanidapu

malloc occupies byte of space in memory location and holds
only one argument of data bytes.
calloc occupies and holds 2 bytes of memory in address
location with arguments databytes,number of data bytes.
calloc occupies in structure of blocks and malloc allocates
in struncture of databytes.

Is This Answer Correct ?    14 Yes 12 No

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

Answer / rinky

malloc use boy as a male condom
calloc use girl as a Female condom

Is This Answer Correct ?    3 Yes 1 No

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

Answer / divya sharma

malloc takes the single argument nd calloc takes two argument
malloc initialize byte of memory while calloc initialize the
block of memory

Is This Answer Correct ?    1 Yes 0 No

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

Answer / md ajij

1.malloc() allocate one block of space in memory , argument
of the malloc is the size of the block.
where as calloc() allocate multiple blocks in the memory
,argument of the malloc() is the size of a block and number
of blocks.

2. malloc() takes garbage value at the initial time where
initial value of calloc() is zero.

Is This Answer Correct ?    1 Yes 0 No

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

Answer / naresh guguloth(iiit,basar)b09

malloc():-
-------
It is used to allocate memory for one variable only.
int*hi=(int*)malloc(sizeof(int));
calloc():-
It is used to allocate memory for any array.
int*bye=(int*)calloc(sizeof(int),10)

Is This Answer Correct ?    1 Yes 0 No

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

Answer / bavithra

malloc() doesnot initialize the allocated memory
calloc() initializes the allocated memory to ZERO

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

What is the use of putchar function?

0 Answers  


What is the time and space complexities of merge sort and when is it preferred over quick sort?

0 Answers   Amazon,


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

0 Answers  


WHAT IS PRE POSSESSORS?

6 Answers   TATA,


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)

2 Answers   Subex, Wipro,


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} what would be the output?

1 Answers   Wipro,


what does static variable mean?

0 Answers   TCS,


Explain how do you convert strings to numbers in c?

0 Answers  


What is true about the following C Functions (a) Need not return any value (b) Should always return an integer (c) Should always return a float (d) Should always return more than one value

2 Answers   DynPro, TCS,


How many identifiers are there in c?

0 Answers  


How many types of arrays are there in c?

0 Answers  


Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

0 Answers  


Categories