codice:
#include <stdio.h>
#include <stdlib.h>
struct albero
{
struct albero *right;
struct albero *left;
char c;
};
typedef struct albero tree;
void insert_head(tree **rad, char a)
{
tree *temp=NULL;
calloc(1,sizeof(tree));
temp->right=temp->left=NULL;
temp->c=a;
*rad=temp;
}
void insert_right(tree **rad, char val)
{
insert_right(&(*rad)->right,val);
}
void insert_left(tree **rad, char val)
{
insert_left(&(*rad)->left,val);
}
int main()
{
char array[66]={'$','$','t','e','m','n','a','i','o','g','k','d','w','r','u','s','$','$','q',
'z','y','c','x','b','j','p','$','l','$','f','v','h','0','9','$','8','$','$','$','7','$','$','$','$','$',
'/','=','6','1','$','$','$','$','+','$','$','2','$','v','$','3','$','4','5','.','!'};
tree *root;
root=NULL;
int i;
char n,m;
insert_head(&root,array[1]);
for(i=1;i<66;i++)
{
n=array[2*i];
insert_right(&root,n);
m=array[2*i+1];
insert_left(&root,m);
}
return 0;
}
mi crasha quando faccio "temp->right=temp->left=NULL;" mi potete dire perchè?