malloc in c

C
ptr = (cast-type*)calloc(n, element-size);ptr = (cast-type*) malloc(byte-size)#include <stdlib.h>

void *malloc(size_t size);

void exemple(void)
{
  char *string;
  
  string = malloc(sizeof(char) * 5);
  string[0] = 'H';
  string[1] = 'e';
  string[2] = 'y';
  string[3] = '!';
  string[4] = '\0';
  printf("%s\n", string);
}

/// output : "Hey!"free(ptr);
Source

Also in C: