insertion into a binary tree

//I'm having trouble inserting an array of integers into a binary

//search tree. The function below is what my last attempt at

//this looked like. Only the first node will print. Any help

//would be greatly appreciated.

//If this code is confusing let me know and I will clarify.

void build_tree(int size, LIST_I data, TREE& t)

{

PT_NODE ptr = t; //local pointer to run through tree

int ct = 0;

PT_NODE p = new NODE;

p->info.i = data[ct];

p->left = NULL;

p->right = NULL;

t = p;

for (ct = 1; ct < size; ++ct) {

ptr = t;

PT_NODE p = new NODE;

p->info.i = data[ct];

p->left = NULL;

p->right = NULL;

while (ptr)

if (p->info.i > ptr->info.i)

ptr = ptr->right;

else

ptr = ptr->left;

ptr = p;

}

}