I have implemented a C calculator to analyses input. I have a struct (like a chained list) but on macOS I have to initialise through the init_null function or variable like value have an initial value. I have just one question: why?
On Linux, there was no issues.
typedef struct node_t {
    int value;
    char operator;
    struct node_t *left;
    struct node_t *right;
} node_t;
node_t *init_null(node_t *root) {
    root->value = NULL;
    root->operator = NULL;
    root->left = NULL;
    root->right = NULL;
    return root;
}
node_t *build_tree(const char *argv[], int *position) {
    node_t *new = malloc(sizeof(node_t));
    new = init_null(new); /*sinon erreur*/
    if (isdigit(*argv[*position])) {
        new->value = atoi(argv[*position]);
    } else/*Opérateur*/  {
        new->operator = *argv[*position];
        *position = *position + 1;
        new->left = build_tree(argv, position);
        *position = *position + 1;
        new->right = build_tree(argv, position);
    }
    return new;
}
When run, ./main * 2 + 3 4 should print (2 * (3 + 4)).
 
    