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

Answer Posted / abhishek pathak mnnit

1- malloc() takes one argument while calloc takes 2 argument.
2- default value of malloc is garvage while calloc is 0;
3- malloc allocate memory in contiguous form while calloc
allocate memory in contiguous form if not avilable the takes
diffrent place.

Is This Answer Correct ?    88 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Describe the order of precedence with regards to operators in C.

615


Explain what is the benefit of using #define to declare a constant?

583


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

620


What is the difference between union and structure in c?

554


How do we make a global variable accessible across files? Explain the extern keyword?

1395






c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above

590


Why are all header files not declared in every c program?

579


general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only

559


a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if

680


Is flag a keyword in c?

652


How can you convert integers to binary or hexadecimal?

591


What would be an example of a structure analogous to structure c?

556


Dont ansi function prototypes render lint obsolete?

584


What are enumerated types?

631


can any one tel me wt is the question pattern for NIC exam

1535