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

Answer Posted / prakashdasari

malloc () for allocating the single block of memory
calloc () for allocating multiple blocks of memory
the values assigned are garbage in case of malloc() and
proper values (zeros) are assigned in case of calloc().

Is This Answer Correct ?    114 Yes 34 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does void main return?

610


Differentiate between declaring a variable and defining a variable?

612


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

1676


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

661


State the difference between realloc and free.

641






What is 2c dna?

611


What are different types of pointers?

566


How can I write a function that takes a format string and a variable number of arguments?

608


If you know then define #pragma?

678


find the sum of two matrices and WAP for it.

638


When should volatile modifier be used?

558


Is this program statement valid? INT = 10.50;

690


How pointers are declared?

565


You have given 2 array. You need to find whether they will create the same BST or not. For example: Array1:10 5 20 15 30 Array2:10 20 15 30 5 Result: True Array1:10 5 20 15 30 Array2:10 15 20 30 5 Result: False One Approach is Pretty Clear by creating BST O(nlogn) then checking two tree for identical O(N) overall O(nlogn) ..we need there exist O(N) Time & O(1) Space also without extra space .Algorithm ?? DevoCoder guest Posted 3 months ago # #define true 1 #define false 0 int check(int a1[],int a2[],int n1,int n2) { int i; //n1 size of array a1[] and n2 size of a2[] if(n1!=n2) return false; //n1 and n2 must be same for(i=0;ia1[i+1]) && (a2[i]>a2[i+1]) ) ) return false; } return true;//assumed that each array doesn't contain duplicate elements in themshelves }

2719


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

697