C/stdlib.h/calloc — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
|
(нет различий)
|
Версия 17:20, 25 мая 2010
calloc: allocates sufficient memory for an array of num objects of size size
<source lang="cpp">
//Declaration: void *calloc(size_t num, size_t size); //Return: returns a pointer to the first byte of the allocated region.
#include <stdlib.h> #include <stdio.h> int main(void){ float *p; p = calloc(100, sizeof(float)); if(!p) { printf("Allocation Error\n"); exit(1); } }
</source>