To free memory ,use the "free" function
char *arr = malloc(3 * sizeof(char)); strcpy(arr, "lautturi"); ... free(arr);