Question d’entretien chez Microsoft

What is the difference between malloc and calloc.

Réponse à la question d'entretien

Utilisateur anonyme

29 févr. 2012

malloc allocates a block of uninitialized memory and returns a pointer to that block of memory. Its signature is along the lines of void* malloc( unsigned long size ). calloc allocates a block of cleared memory and returns a pointer to that block of memory. Its signature is along the lines of void* calloc( unsigned long size, unsized long count ).