Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179
Deprecated: Creation of dynamic property PPDStack::$accum is deprecated in /var/www/cppe.ru/www/includes/parser/Preprocessor_DOM.php on line 803
Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/includes/exception/MWExceptionHandler.php on line 179
Deprecated: Constant E_STRICT is deprecated in /var/www/cppe.ru/www/vendor/mediawiki/at-ease/src/Functions.php on line 48
Материал из C\C++ эксперт
calloc: allocates sufficient memory for an array of num objects of size size
//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);
}
}