I need help to understand why this is not working.
I'm trying to malloc and assign instructions and separators through another function. With everything I have tried, I get a segmentation fault on the second assignment *separators[1] = '1', but for some reason, *separators = '2' works.
I think there is something I don't understand with referenced pointers.
Here is my simplified code
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
void        split_instructions(char ***instructions, char **separators)
{
    int split_len = 2;
    *instructions = (char **)malloc(sizeof(char*) * split_len + 1);
    if (*instructions == NULL)
        return;
    *separators = (char *)malloc(sizeof(char) * split_len + 1);
    if (*separators == NULL)
    {
        free(instructions);
        return;
    }
    *separators[0] = (char)'q';
    *separators[1] = (char)'1';
    //*separators = "22"; <- this work
    *instructions[0] = (char*)"test";
    *instructions[1] = (char*)"test2";
}
int main(void)
{
   char **instructions;
   char *separators;
   
   split_instructions(&instructions, &separators);
}
 
    