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

Answer Posted / jayakrishnan d

1.malloc is only one argument function while malloc is a
two arguments function.
2.malloc allocates bytes of memory while calloc allocates
array of memory.
3.malloc does not initialize the size of allocated memory ie
gabage value while calloc is initialize size of allocated
memory to '0'.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What’s the special use of UNIONS?

650


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?

1904


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

621


Write a C program linear.c that creates a sequence of processes with a given length. By sequence it is meant that each created process has exactly one child. Let's look at some example outputs for the program. Here the entire process sequence consists of process 18181: Sara@dell:~/OSSS$ ./linear 1 Creating process sequence of length 1. 18181 begins the sequence. An example for a sequence of length three: Sara@dell:~/OSSS$ ./linear 3 Creating process sequence of length 3. 18233 begins the sequence. 18234 is child of 18233 18235 is child of 18234 ........ this is coad .... BUt i could not compleate it .....:( #include #include #include #include int main(int argc, char *argv[]) { int N; pid_t pid; int cont; if (argc != 2) { printf("Wrong number of command-line parameters!\n"); return 1; } N = atoi(argv[1]); printf("Creating process sequence of length %d.\n",N); printf("%d begins the sequence.\n",getpid()); /* What I have to do next ?????? */ }

1612


Is a pointer a kind of array?

589






What is the use of bit field?

625


What is the general form of #line preprocessor?

577


Differentiate between full, complete & perfect binary trees.

663


What is structure in c definition?

562


What is function and its example?

619


What is the difference between union and anonymous union?

828


What is extern variable in c with example?

530


What is the difference between variable declaration and variable definition in c?

553


Tell us something about keyword 'auto'.

655


Why header files are used?

634