answersLogoWhite

0


Best Answer

In C, malloc is used to reserve a predetermined size of memory.

void * malloc ( size_t size );

calloc is used to reserve a chunk of memory large enough to store num elements, each of a predetermined size.

void * calloc ( size_t num, size_t size );

To create a char array of size 10 you can do it in one of two ways:

char* mChars = malloc( 10 * sizeof(char) );

char* cChars = calloc( 10, sizeof(char) );

There is no concept of malloc or calloc in Java.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between Malloc and calloc in C and JAVA?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is difference between java 2 and java 5?

They are different versions. Java 5 is newer than Java 2. Think of it like the difference between the Playstation 1 and the Playstation 3.


Major difference between c and java?

Java is object oriented, C is not...


What is the difference between connectivity in java?

kamina


What is difference between connectivity in java?

kamina


What is the main difference between UNIX and JAVA?

Unix is an operating system, Java is a language.


Difference between recordset and resultset in java?

Rowset


What is the difference between JAD and JAR?

JAD-Java Application Description JAR-Java archive


What is the difference between java and object oriented programming?

java is a programming language/platform that embodies object oriented programming concepts. The question of what is the difference is like asking what is the difference between cars and a Volvo.


What is the difference between c plus plus and java programming?

Java doesn't have pointers. C++ has pointers.


What difference between InputStreamReader and DatainputStream in java?

Both are same


WAP to show the difference between a variable and static variable?

difference between constant and static variables in java


What is the difference between Windows and Java?

Windows is an operating system whereas Java is a programming language. They are entirely different.