answersLogoWhite

0

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

15y ago

What else can I help you with?