WHAT IS THE DIFFERENCE BETWEEN malloc() and calloc() in c
file management?
Answer Posted / chris_sreekanth
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 ? | 268 Yes | 63 No |
Post New Answer View All Answers
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
What are the valid places to have keyword “break”?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What is the value of uninitialized variable in c?
What is time complexity c?
Is Exception handling possible in c language?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
Why use int main instead of void main?
What does double pointer mean in c?
What are the usage of pointer in c?
What are the ways to a null pointer can use in c programming language?
write a program to print largest number of each row of a 2D array
Can you apply link and association interchangeably?
Explain pointers in c programming?