P
Prasad
I am executing this program but, getting error Segmentation Fault.
Can any one point out the error in this?
#include<iostream>
using namespace std;
typedef struct __Node
{
int data ;
struct __Node *left, *right ;
} NODE ;
NODE *ROOT = NULL ;
void Insert ( NODE *root, NODE *nNode )
{
if ( root )
{
//////////////
}
else
{
*root = nNode ;
}
}
void Insert ( int data )
{
NODE *tmp = new NODE ;
tmp -> left = tmp -> right = NULL ;
tmp -> data = data ;
Insert ( ROOT, tmp ) ;
}
int main ()
{
Insert ( 10 ) ;
cout << ROOT -> data << endl ;
return 0 ;
}
Thanks in advance.
Prasad
Can any one point out the error in this?
#include<iostream>
using namespace std;
typedef struct __Node
{
int data ;
struct __Node *left, *right ;
} NODE ;
NODE *ROOT = NULL ;
void Insert ( NODE *root, NODE *nNode )
{
if ( root )
{
//////////////
}
else
{
*root = nNode ;
}
}
void Insert ( int data )
{
NODE *tmp = new NODE ;
tmp -> left = tmp -> right = NULL ;
tmp -> data = data ;
Insert ( ROOT, tmp ) ;
}
int main ()
{
Insert ( 10 ) ;
cout << ROOT -> data << endl ;
return 0 ;
}
Thanks in advance.
Prasad