Allocate with calloc

    0

    0

    Giovanny Gongora

    Codiga's C Recipes

    Allocate memory using calloc

    {type} ptr = ({type})calloc(, sizeof({type}));
    if (ptr == NULL) {
    	printf("Memory allocation failed!\n");
    	exit(0);
    }
    free(ptr); 
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.