Q:

pointers and values

I have written the following code, and it prints the root value correctly, but not the ret value. Here a memory address is potentially printed (1707388). I believe that ret could now be modified and the result would be seen in main. Any help is appreciated.
#include <stdlib.h>

struct node{
int value;
    int order;
    struct node *left;
    struct node *right;
};

typedef struct node node_t;

node_t array[10];

void createTree(node_t *p, int order){
    p->value = rand()%10;
    p->order = order;
    printf("%i", p->value);
    printf(" ");
    printf("%i\n", p->order);
    if (!order){
        p->left = NULL;
        p->right = NULL;
        return; 
    }
    order--;
    createTree(&p->left, order);
    createTree(&p->right, order);
}

void traverse(node_t *current, node_t *ret, int size){
    printf("%i\n", current->value); 
    if (current->value > size){
        ret = current;
        traverse(&current->left, &ret, size);
        traverse(&current->right, &ret, size); 
    } 
    return;
}

int main(void){
    node_t *root = &array[0];
    node_t *ret;
    srand(time(NULL));
    createTree(root, 4);
    int i = 3;
    printf("%s", "root-value: ");
    printf("%i\n", root->value);
    traverse(root, ret, i);
    printf("%s", "root-value: ");
    printf("%i\n", root->value);
    printf("%i\n", ret->value);
    return 1;
}

A:

This:
void createTree(node_t *p, int order)

Should be 
void createTree(node_t **p, int order)

Otherwise you are modifying a local node_t pointer, instead of the one outside the function. Your tree isn't being built properly either.

A:

You are passing ret by value to
void traverse(node_t *current, node_t *ret, int size){

When the function changes ret, the changes do not propagate back to the caller.
This means that ret in main() remains uninitialized, and the behaviour of your code is undefined.
To fix this, make traverse either return ret, or take it as node_t**.

