allocate memory c
snippet in c

allocate memory c

user1614

// Use malloc to allocate memory
ptr = (castType*) malloc(size);
int *exampl = (int*) malloc(sizeof(int));
// Use calloc to allocate and inizialize n contiguous blocks of memory
ptr = (castType*) calloc(n, size);
char *exampl = (char*) calloc(20, sizeof(char));

allocate memory c

user548

ptr = (castType*)calloc(n, size);